Posted by Kim Andrι Akerψ on 03/27/07 14:42
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
}
http://php.net/mysql_data_seek
--
Kim AndrΓ© AkerΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Navigation:
[Reply to this message]
|