mysqli bind_param给出错误:(1210)mysql_stmt_execute的参数不正确 [英] mysqli bind_param giving error: (1210) Incorrect arguments to mysql_stmt_execute

查看:185
本文介绍了mysqli bind_param给出错误:(1210)mysql_stmt_execute的参数不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有完全相同的代码在另一台服务器上也能很好地工作:

I have this exact same code working great on another server:

$mysqli_Cxn = new mysqli($SQL_HOST,$SQL_USER,$SQL_PASS,$SQL_DB);
if($mysqli_Cxn->connect_errno){
echo 'Unable to connect!!';
exit();
}

$userID=12345;
$userFirstName = 'Charley';
$userLocale = 'en_US';

$sql = "UPDATE userProfile SET userFirstName=?, userLocale=? WHERE id=?";

if($stmt = $mysqli_Cxn->prepare($sql)){
 if(!$stmt->bind_param('ssi',$userFirstName,$userLocale,$userID)){
  echo "<br/><br/>Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error;
 }
 if($stmt->execute()){
  totalAffected=$stmt->affected_rows;
  if($totalAffected>=1){
   echo '<br/><br/>UPDATE OK: Affected rows = '. $totalAffected;
  }
 }else{
  echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
 }
}
$stmt->close();

该代码为我提供了以下输出: 执行失败:(1210)mysql_stmt_execute的参数不正确

That code gives me the following output: Execute failed: (1210) Incorrect arguments to mysql_stmt_execute

如果我更改这两行:

$sql = "UPDATE userProfile SET userFirstName=?, userLocale=? WHERE id=?";
$stmt->bind_param('ssi',$userFirstName,$userLocale,$userID);

对此:

$sql = "UPDATE userProfile SET userFirstName=?, userLocale='en_US' WHERE id=12345";
$stmt->bind_param('s',$userFirstName);

...然后更新成功,并且我没有收到任何错误.

...then the Update is successful and I don't get any error.

有人知道为什么我不能在此代码中绑定多个参数吗?

我使这段代码在Centos 4.9,PHP 5.3.3,MySQL 5.0.91/5.0.91-community-log上完美运行

I had this code running perfectly on a Centos 4.9, PHP 5.3.3, MySQL 5.0.91/5.0.91-community-log

我需要在当前的服务器上运行它,该服务器是Centos 6.2,PHP 5.3.10,MySQL 5.0.95-community-log

I need to run it on my current server which is Centos 6.2, PHP 5.3.10, MySQL 5.0.95-community-log

推荐答案

我做了一些研究,似乎与MySQL版本和GCC版本以及所使用的优化标志结合使用时,在MySQL源中报告了错误. 如果您无法更改MySQL版本,请尝试在CFLAGS中添加-fno-strict-aliasing来重新编译MySQL.

I did a little research, and it seems like a reported error in the MySQL source in combination with your version of GCC and the optimization flags you use. If you can't change the MySQL version, try recompile MySQL with added -fno-strict-aliasing to your CFLAGS.

请参见 http://bugs.mysql.com/bug.php?id=48284 了解更多详细信息

See http://bugs.mysql.com/bug.php?id=48284 for some more details

这篇关于mysqli bind_param给出错误:(1210)mysql_stmt_execute的参数不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆