note 90089 rejected from mysqli-stmt.error by thiago

From: Date: Mon, 06 Apr 2009 00:57:10 +0000
Subject: note 90089 rejected from mysqli-stmt.error by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-152848@lists.php.net to get a copy of this message
Note Submitter: alex at alexdemers dot me ---- Note: The mysqli_stmt::num_rows doesn't work when used without mysqli_stmt::store_result. It may need more explanations as to why in the code above. <?php $stmt = $db->prepare('SELECT FirstName, LastName, Age FROM users WHERE UserID = ? ORDER BY LastName'); $stmt->execute(); $stmt->store_result(); $stmt->bind_result($firstname, $lastname, $age); if ($stmt->num_rows > 0) { while ($stmt->fetch()) { echo $firstname.' '.$lastname.': '.$age.' years old.'; } } else { echo 'No users with that ID.'; } ?>

« previous php.notes (#152848) next »