Will code for food; The ramblings of Talifhani Luvhengo;

Reseting the mysql pointer

Sometimes you need access the mysql result set after you have already accessed it using




or whatever. The chances are if you try a mysql_fetch_anything()*[not a really method guys] the function will return a false cause it has reached the end of the result set.

So how do you fix that? Easy. php has a function called

mysql_data_seek(resource $result, int $row_number)

, where $result is your result set, eg

$result = mysql_query('Select * from table');

and $row_number is the row you would like to move the pointer to. This number ranges from 0 to

msyql_num_rows() - 1

So if you want to go to the begining you would use

mysql_data_seek($result, 0);

Hope this helps

Get Adobe Flash player

Page optimized by WP Minify WordPress Plugin