To reuse an existing result set returned from a query is actually pretty simple thanks to PHP’s mysql_data_seek function and the fact that mysql_query returns a buffered result set by default.

So essentially all we want to do is rewind the entire pointer right to the start in order to reuse the set.

And to do this?

mysql_data_seek($result, 0);