PHP mysqli_next_result() function prepares the next result set from mysqli_multi_query()
Syntax
bool mysqli_next_result(void);
Parameter | Description |
---|---|
NA | NA |
Return Values : | Returns TRUE on success or FALSE on failure. |
<?php $con = mysqli_get_charset("localhost","user","password","db"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $query = "SELECT fname,lname from employee;"; $query .= "SELECT grad, dept from department"; if (mysqli_next_result($con, $query)) { do { // store first result set if ($result = mysqli_store_result($con)) { while ($row = mysqli_fetch_row($result)) { echo $row[0]; } mysqli_free_result($result); } } } while (mysqli_next_result($con)); } mysqli_close($con); ?>