Posted by Ciaran on 03/27/07 14:54
On Mar 27, 3:42 pm, Kim André Akerø <kiman...@NOSPAMbetadome.com>
wrote:
> Ciaran wrote:
> > Hi is there a way of duplicating the same mysql_query resource result
> > or is there a way to stop it from being cleared once it is no longer
> > needed? I need to run a ... while(mysql_fetch_array($result)) ... loop
> > twice and I want to avoid re-runnuing the query.
>
> Sure thing, just use the mysql_data_seek() function between the while()
> loops, like this:
>
> while($rowdata = mysql_fetch_array($result)) {
> // do something}
>
> mysql_data_seek($result, 0);
> while($rowdata = mysql_fetch_array($result)) {
> // do something entirely different
>
> }
Fantastic! Thanks a lot!
Ciarán
[Back to original message]
|