本文介紹了INSERT - 綁定變量的數量與準備好的語句中的字段數量不匹配的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我得到:
警告:mysqli_stmt::bind_result():綁定變量的數量沒有匹配準備好的語句中的字段數E:XAMPPhtdocsaccountlib egister.php 第 73 行
Warning: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement in E:XAMPPhtdocsaccountlib egister.php on line 73
當我使用此代碼時:
if($stmt = $conn -> prepare("INSERT INTO login(user, pass) VALUES(?, ?)")) {
/* Bind parameters s - string, b - blob, i - int, etc */
$stmt -> bind_param("ss", $user, $pw);
/* Execute it */
$stmt -> execute();
/* Bind results */
$stmt -> bind_result($user, $pw);
/* Close statement */
$stmt -> close();
$userId = $conn->insert_id;
}
我不明白,為什么每次都發生這種情況,我的代碼片段有什么問題?
I can't understand, why this happens every time, what is wrong in my code snippet?
推薦答案
您正在嘗試對未返回任何結果的語句進行bind_result
.
You are attempting to bind_result
on a statement that is not returning any results.
刪除此行.<代碼>$stmt ->bind_result($user, $pw);
這篇關于INSERT - 綁定變量的數量與準備好的語句中的字段數量不匹配的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!