2017-07-19 88 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 –

相关问题