PHP mysqli_use_result() Function

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);

mysqli_use_result() Function Parameter

ParameterDescription
connection :Required parameter. The MySQL connection to be used

mysqli_use_result() Function Return Value

Return Values :Returns an unbuffered result object or FALSE if an error occurred.

mysqli_use_result() Function Example

<?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);
?>