我对 PHP 比较陌生,正在学习绑定。我收到绑定错误:
“mysqli_stmt::bind_param():变量数与准备语句中的参数数不匹配”
if( isset( $_GET['last_name'],$_GET['id'] )) {
$last_name = trim($_GET['last_name']);
$id = trim($_GET['id']);
$people = $db->prepare( "select firstName, last_name, id from people where last_name = ? or id >= ?");
$people->bind_param('ssi', $first_name, $last, $id);
$people->execute();
$people->bind_result( $first_name, $last, $id );
我在 bind_param 行上遇到错误。我有“ssi”,虽然我的意思是字符串、字符串、整数,并且我有三个变量。在我的选择中,我有三个正确命名的字段。如果我更改为“si”并删除任一名称字段,它工作正常。所以我很困惑为什么添加第二个字符串不起作用。