mysqli bind_param giving error: (1210) Incorrect arguments to mysql_stmt_execute

mysqli, php

Solution

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.

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

Problem

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(); ``` That code gives me the following output: Execute failed: (1210) Incorrect arguments to mysql_stmt_execute If I change these two lines: ``` $sql = "UPDATE userProfile SET userFirstName=?, userLocale=? WHERE id=?"; $stmt->bind_param('ssi',$userFirstName,$userLocale,$userID); ``` to this: ``` $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. Does anyone know why I can't bind more than one param in this code? I had this code running perfectly on a Centos 4.9, PHP 5.3.3, MySQL 5.0.91/5.0.91-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

Original source