【发布时间】:2015-12-30 22:18:09
【问题描述】:
我收到以下错误:
Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement
我在绑定和执行准备语句时遇到问题。与数据库的连接已成功建立,它确实设法将其插入数据库中,初始值为?
下面是代码:
// Set up the query
$insert = "INSERT INTO record_user (ip,country,address,stack,skills,employment_type,city_selection,landing_time,submission_time,time_spent)
VALUES ('?','?','?','?','?','?','?','?','?','?')";
// Prepare the statement
$insert = $con->prepare($insert);
// Bind the statement
$insert->bind_param("ssssssssss", $user_ip, $country, $location, $stack, $skills, $employment, $city, $landing_time, $submission_time, $time_spent);
// Execute the statement
$insert->execute();
// Close the statement connection
$insert->close();
// Close the database connection
$con->close();
【问题讨论】:
-
不要将
?放在引号中。该框架为您完成所有转义
标签: php mysql sql-server mysqli