note 71439 modified in function.mysqli-stmt-prepare by danbrown

From: Date: Fri, 28 Nov 2008 22:49:54 +0000
Subject: note 71439 modified in function.mysqli-stmt-prepare by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-147387@lists.php.net to get a copy of this message
Do not try to use a stored procedure through a prepared statement. Example: <?php $statement = $mysqli->stmt_init(); $statement->prepare("CALL some_procedure()"); ?> If you attempt to do this, it will fail by dropping the connection during the next query. Use mysqli_multi_query instead. Example: <?php $mysqli->multi_query("CALL some_procedure()"); do { $result = $mysqli->store_result(); // Do your processing work here $result->free(); } while($mysqli->next_result()); ?> This means that you cannot bind parameters or results, however. --was-- Do not try to use a stored procedure through a prepared statement. Example: <?php $statement = $mysqli->stmt_init(); $statement->prepare("CALL some_procedure()"); ?> If you attempt to do this, it will fail by dropping the connection during the next query. Use mysqli_multi_query instead. Example: <?php $mysqli->multi_query("CALL some_procedure()"); do { $result = $mysqli->store_result(); // Do your processing work here $result->free(); } while($mysqli->next_result()); ?> This means that you cannot bind parameters or results, however. http://php.net/manual/en/function.mysqli-stmt-prepare.php

« previous php.notes (#147387) next »