[英]Number of elements in type definition string doesn't match number of bind variables
I keep getting this error in my php file .. Warning: mysqli_stmt_bind_param() [function.mysqli-stmt-bind-param]: Number of elements in type definition string doesn't match number of bind variables in ... on line 17 Heres is my code - I am trying to read everything from this table and store each column such as the username, or obo into an array, could be one whole array, or indiviudal ones for each Thanks 我一直在我的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);
?>
Heres a picture of my php my admin table 这是我的php我的管理表的图片
You are calling Select statement and not binding anything. 您正在调用Select语句,但未绑定任何内容。 Remove this line
删除此行
mysqli_stmt_bind_param($statement, $username,$title,$description,$location,$cost,$obo,$dimmension,$phone,$email,$image,$image2);
and code will work properly. 并且代码将正常工作。 Good luck.
祝好运。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.