I have a mysql_query result which I repeat several times in different parts of the code, each time using mysql_data_seek ($ result, 0) to reset at the beginning of the result.
I am using mysql_fetch_array for these results and would like to remove a few specific rows from the $ result. Basically equivalent to unset ($ result [$ row]) if it was a normal array. Is there any way to do this?
Code example:
$result = mysql_query( $sql );
$num_rows = mysql_num_rows( $result );
if( $num_rows ){
for( $a=0; $a < $num_rows; $a++ ){
$row = mysql_fetch_array( $result );
if( my_check_function( $row['test'] ){
// do stuff
} else {
// remove this row from $result
}
}
}
mysql_data_seek( $result, 0 );
I know that I can just do unset ($ row [$ a]) to delete this specific row, but after the data is searched and I go through the results the next time, I get the same original rows of results.
.
ps - , _ , , ..:)