![](/img/trans.png)
[英]bind_param error - Number of elements in type definition string doesn't match number of bind variables
[英]Number of elements in type definition string doesn't match number of bind variables
我一直在我的PHP文件中收到此错误。.警告:mysqli_stmt_bind_param()[function.mysqli-stmt-bind-param]:类型定义字符串中的元素数量与...在第17行上的绑定变量数量不匹配这是我的代码-我正在尝试从该表中读取所有内容,并将每列(例如用户名或obo)存储到一个数组中,每个数组可能是一个完整的数组,也可能是单个的数组
<?php
$con = mysqli_connect("*****", "****", "***", "***");
$username = $_POST["username"];
$title = $_POST["title"];
$description = $_POST["description"];
$location = $_POST["location"];
$cost = $_POST["cost"];
$obo = $_POST["obo"];
$dimmension = $_POST["dimmension"];
$phone = $_POST["phone"];
$email = $_POST["email"];
$image = $_POST["image"];
$image2 = $_POST["image2"];
$statement = mysqli_prepare($con, "SELECT username,title,description,location,cost,obo,dimmension,phone,email,image,image2 FROM Postings");
mysqli_stmt_bind_param($statement, $username,$title,$description,$location,$cost,$obo,$dimmension,$phone,$email,$image,$image2);
mysqli_stmt_execute($statement);
mysqli_stmt_store_result($statement);
mysqli_stmt_bind_result($statement, $username,$title,$description,$location,$cost,$obo,$dimmension,$phone,$email,$image,$image2);
$response = array();
while(mysqli_stmt_fetch($statement)){
$response[] = $username;
}
$response["success"] = true;
#echo json_encode($respond);
echo json_encode($response);
?>
这是我的php我的管理表的图片
您正在调用Select语句,但未绑定任何内容。 删除此行
mysqli_stmt_bind_param($statement, $username,$title,$description,$location,$cost,$obo,$dimmension,$phone,$email,$image,$image2);
并且代码将正常工作。 祝好运。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.