Maksim Ivanov Maksim Ivanov - 1 year ago 83
MySQL Question

mysqli - how to fetch a row without altering the result set?

Is it possible to extract a value from mysqli_result without fetching a row i.e. without altering the result set as I need it in full later in my code?

Answer Source

You can also point the iterator back to the beginning. ie..

$result = $mysqli->query($query);
while($row = $result->fetch_assoc())
    //do stuff with the result
//back to the start

now the pointer is returned to the beginning. mysqli_data_seek

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download