OK. I'm doing a mysql_query(), then iterating through the results with a mysql_fetch_array().
$result = mysql_query($qry, $db);
$num_rows = mysql_num_rows($result);
set continue_flag to true
while ( continue_flag is true) {
set continue_flag to false
$val = get a random number between 1 and $num_rows;
for ($i = 0; $i < $num_rows; $i++) {
$entry = mysql_fetch_array($result);
if ($i == $val) {
//
// blah blah
//
if (val isn't the result I want) {
reset_the_results
set continue_flag to true
}
}
}
}
I'd like to be able to reset the pointer that mysql_fetch_array() uses to iterate thru the results. In other words, I don't want to have to call mysql_query each time.
I'd like to go back and somehow set the $result pointer to the beginning of the results, such that a call to mysql_fetch_array() will return the first record.
Is there a way to do this without another call to the database?