mysqli prepare statment error?

Posted by user310850 on Stack Overflow See other posts from Stack Overflow or by user310850
Published on 2010-05-18T19:26:25Z Indexed on 2010/05/18 19:30 UTC
Read the original article Hit count: 228

Filed under:
|
|
|

Hi all,

$mysqli = new mysqli("localhost", "root", "", "test");
$mysqli->query('PREPARE mid FROM "SELECT name FROM test_user WHERE id = ?"');
//$mysqli->query('PREPARE mid FROM "SELECT name FROM test_user" ');
$res = $mysqli->query( 'EXECUTE mid 1;') or die(mysqli_error($mysqli));

while($resu = $res->fetch_object()) {
    echo '<br>' .$resu->name;
}

Error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1

my php version is PHP Version 5.3.0 and mysql

mysqlnd 5.0.5-dev - 081106 - $Revision: 1.3.2.27 $ 

© Stack Overflow or respective owner

Related posts about mysql

Related posts about php