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)存储到一个数组中,对于每个Thanks
,可能是一个完整的数组,也可能是单个的数组
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | <?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语句,但未绑定任何内容。删除此行
1 | mysqli_stmt_bind_param($statement, $username,$title,$description,$location,$cost,$obo,$dimmension,$phone,$email,$image,$image2); |
,代码将正常运行。祝你好运。