私のPHPファイルでこのエラーが発生しています。 警告:mysqli_stmt_bind_param()[function.mysqli-stmt-bind-param]:要素数型定義文字列が行内のバインド変数の数と一致しません。 Heresは私のコードです。このテーブルからすべてを読み込み、ユーザー名やoboなどの各列を配列に格納しようとしています。私の管理テーブルの私のPHPの絵相続人それぞれのおかげ型定義文字列の要素数がバインド変数の数と一致しません
<?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);
?>
のために1つの配列全体、またはindiviudalものでも
パラメータをバインドしていないため、そのステートメントは必要ありません。バインド・パラメータは次のような文に使用されます。select titles from postings username =? –
この文には実際には 'mysqli_stmt_bind_param'は必要ありません。その行を削除するだけで大丈夫です。ユーザー入力をバインドするためにその関数を使用します。 –