这是我第一次使用 Mysqli,我被这个问题困扰了大约一个小时。我收到此错误
mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters
in prepared statement in C:\wamp\www\WebContent\success.php on line 30
我数了准备语句中问号的 10 倍,有 21 个,然后我数了 bind_param 中的 s 和变量,也有 21 个。我是 Mysqli 的新手,我想知道是否可以就如何解决和调试此问题获得任何建议,感谢您的所有帮助
<?php
$mysqli = new mysqli("localhost", "root","","test");
if (mysqli_connect_errno())
{
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$i=0;
if ($stmt = $mysqli->prepare("UPDATE `table` SET `Lan_ID` = '?', `Switching` = '?',
`Own` = '?',`Division` = '?',`Switch_Number` = '?',
`Telecom_Circuit_number` = '?', `Transmitter_Frequency` = '?',
`Receiver_Frequency` = '?', `Band_width` = '?', `Channel` = '?',
`Equipment` = '?', `Power` = '?',
`Line_designation` = '?', `Voltage` = '?', `Phase` = '?',
`Modulate` = '?', `Terms` = '?', `Trap` = '?',
`Ltunner` = '?', `Link` = '?',
`Comment` = '?' ". $_GET['where'.$i] ))
{
$stmt->bind_param('sssssssssssssssssssss', $_GET[$i.'LanID'],$_GET[$i.'Switching'],
$_GET[$i.'Own'], $_GET[$i.'Division'], $_GET[$i.'Switch_Number'], $_GET[$i.'Telecom_Circuit_number'],
$_GET[$i.'Trasmitter_frq'], $_GET[$i.'Receiver_frq'], $_GET[$i.'Band_width'], $_GET[$i.'Channel'],
$_GET[$i.'Equipment'], $_GET[$i.'Power'], $_GET[$i.'Line_designation'],$_GET[$i.'Voltage'],
$_GET[$i.'Phase'],$_GET[$i.'Modulate'],$_GET[$i.'Terms'], $_GET[$i.'Trap'],$_GET[$i.'Ltunner'],
$_GET[$i.'Link'], $_GET[$i.'Comment'] );//this is line 30 btw
}
else
{
printf("Prepared Statement Error: %s\n", $mysqli->error);
}
$stmt->close();
?>