2017-07-19 102 views
-2

我不知道爲什麼發生這種情況,我不斷收到此錯誤警告:警告:mysqli_stmt :: bind_param():變量數不準備語句相匹配的參數個數

mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement

$stmt = $conn->prepare("SELECT clicks FROM affiliate WHERE ID ='$ID'"); 
$stmt->bind_param("i", $ID); 
$stmt->execute(); 
$stmt->bind_result($clicks); // Store the result in the $clicks variable 
+3

可能的重複[PHP警告:mysqli \ _stmt :: bind \ _param():變量數量與預準備語句中的參數數量不匹配](https://stackoverflow.com/questions/16865151/php- warning-mysqli-stmtbind-param-of-variables-doesnt-match-number) – mickmackusa

回答

-1

在查詢中用?替換'$ID'。問號用於標記需要綁定的變量。

+0

@Enstage致命錯誤:未捕獲錯誤:無法通過引用傳遞參數2 –

相關問題