Hello everyone:
I have the following code that works, but the only way it is working is if I hit the database twice to get my $result array back to the top. It is the same query and all I want to do is put the "record pointer" back to the front of the array. I have tried reset(), but it does not seem to work. Any help appreciated.
===========
$result = mysql_query($sql, $connection) or die( "Could not execut sql: $sql"
;
$num_result = mysql_num_rows($result);
for ($i=0; $i < $num_result; $i++) {
$row = mysql_fetch_array($result);
$disp_array[$row["logid"]] = "no";
}
// re-hit the database with the same query to reset the record pointer to the first record
$result = mysql_query($sql, $connection) or die( "Could not execut sql: $sql"
;
I have the following code that works, but the only way it is working is if I hit the database twice to get my $result array back to the top. It is the same query and all I want to do is put the "record pointer" back to the front of the array. I have tried reset(), but it does not seem to work. Any help appreciated.
===========
$result = mysql_query($sql, $connection) or die( "Could not execut sql: $sql"
$num_result = mysql_num_rows($result);
for ($i=0; $i < $num_result; $i++) {
$row = mysql_fetch_array($result);
$disp_array[$row["logid"]] = "no";
}
// re-hit the database with the same query to reset the record pointer to the first record
$result = mysql_query($sql, $connection) or die( "Could not execut sql: $sql"