PHP mysqli_use_result() function is used to initiates the retrieval of a result set from the last query executed using the mysqli_real_query().
Syntax
object mysqli_use_result(connection);
Parameter | Description |
---|---|
connection : | Required parameter. The MySQL connection to be used |
Return Values : | Returns an unbuffered result object or FALSE if an error occurred. |
<?php $con = mysqli_connect("localhost","user","password","db"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } mysql_query($con, "SELECT fname,lname FROM employee"); $result = mysql_use_result($con); $num_fields = mysql_field_count($con); while($row = mysql_fetch_row($result)) { echo $row[0]. " " . $row[1]; } mysqli_close($con); ?>