RE: RE :[PHP-DB] MySQLi Help

From: Date: Mon, 18 Jun 2012 06:36:05 +0000
Subject: RE: RE :[PHP-DB] MySQLi Help
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-48322@lists.php.net to get a copy of this message
Oliver, Gah -- thank you. James -----Original Message----- From: "Olivier Desmares" <olivier.d.css@orange.fr> Sent: Saturday, June 16, 2012 10:58am To: "jstarritt@selagodesign.com" <jstarritt@selagodesign.com>, "php-db@lists.php.net" <php-db@lists.php.net> Subject: RE :[PHP-DB] MySQLi Help Hi James, The manual page for mysqli_stmt::execute has the following note : When using mysqli_stmt_execute(), the [http://fr2.php.net/manual/en/mysqli-stmt.fetch.php] mysqli_stmt_fetch() function must be used to fetch the data prior to performing any additional queries. So you cannot execute the inner (sub) query without first retrieving all the rows from the outer (main) query. Olivier Desmares $stmt = mysqli_prepare($db, $sql); mysqli_stmt_execute($stmt); mysqli_stmt_bind_result($stmt, $authkv); while (mysqli_stmt_fetch($stmt)) { echo "<p>MAIN: $authkv</p>"; sub($db); } mysqli_stmt_close($stmt); This simple change results in the output.. MAIN: 7 Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in /var/www/html/xgwebapi/mysqli.php on line 21 Warning: mysqli_stmt_bind_result() expects parameter 1 to be mysqli_stmt, boolean given in /var/www/html/xgwebapi/mysqli.php on line 22 Warning: mysqli_stmt_fetch() expects parameter 1 to be mysqli_stmt, boolean given in /var/www/html/xgwebapi/mysqli.php on line 24 Warning: mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean given in /var/www/html/xgwebapi/mysqli.php on line 28 ********************************************* James Starritt Selago Design, Inc. US: (312) 239 0592 jstarritt@selagodesign.com *********************************************

« previous php.db (#48322) next »