PHP and Mysql Queries
| From: | Jason McCormack | Date: | Tue, 20 May 2003 04:00:50 +0000 |
| Subject: | PHP and Mysql Queries | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-27907@lists.php.net to get a copy of this message | ||
Hello All,
I have a script that runs a mysql query against my database. I need to loop through the array of data twice. My script runs the first loop as expected but when it runs the second loop I get no data returned. Is there a way to be able to loop through the same data result set twice without having to take the data set and put it into a different array variable. Any ideas are greatly appreciated.
Thanks,
Jason
Code Block
$q_navmenu = "select navmenu,count(navmenu) as count from sitenav where navgroup = 'toc' and active = 'T' group by navmenu order by navmenu";
$h_navmenu = mysql_query($q_navmenu,$connect);
while($rows = mysql_fetch_array($h_navmenu))
{
$navmenu = $rows["navmenu"];
echo $navmenu . "<br>";
}