gpt4 book ai didi

php - Mysqli 抛出 "Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given"

转载 作者:可可西里 更新时间:2023-11-01 13:44:18 28 4
gpt4 key购买 nike

<分区>

我知道这段代码可以在我的另一个网站上运行,但它今天不起作用。我收到三个警告:

Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in /homepages/14/d248783986/htdocs/subdomains/clients.bionic-comms.co.uk/httpdocs/carefree/process.php on line 33

Warning: mysqli_execute() expects parameter 1 to be mysqli_stmt, boolean given in /homepages/14/d248783986/htdocs/subdomains/clients.bionic-comms.co.uk/httpdocs/carefree/process.php on line 34

Warning: mysqli_stmt_affected_rows() expects parameter 1 to be mysqli_stmt, boolean given in /homepages/14/d248783986/htdocs/subdomains/clients.bionic-comms.co.uk/httpdocs/carefree/process.php on line 35

谁能帮我解决这个问题?

如果有帮助,我必须使用 htaccess 升级到 PHP5。

$connection = mysqli_connect($hostname, $username, $password, $dbname);

if (!$connection) {
die('Connect Error: ' . mysqli_connect_error());
}

$query = "INSERT INTO entries (name, dob, school, postcode, date) VALUES (?,?,?,?,?)";
$stmt1 = mysqli_prepare($connection, $query);
mysqli_stmt_bind_param($stmt1, 'sssss',$name,$dob,$school,$postcode,$date);
mysqli_execute($stmt1);
if(mysqli_stmt_affected_rows($stmt1) != 1)
die("issues");
mysqli_stmt_close($stmt1);
return "new";

编辑

经过一番调查后发现 prepare 语句与 mysql4 不兼容。我已经创建了一个新的 mysql5 数据库,但是当我尝试连接时出现此错误:

Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2005): Unknown MySQL server host 'localhost:/tmp/mysql5.sock' (1)

有人知道为什么会这样吗?

28 4 0