I've got the following script:
$sql = "SELECT * FROM table";
$query = mysql_query($sql);
while($array = mysql_fetch_array($query))
{
echo $array[row]."<br>";
}
while($array = mysql_fetch_array($query))
{
echo $array[row]."<br>";
}
I basically want to take and loop through the values of a table. But I want to do this twice, maybe even more than twice, but it won't work unless I redeclare the $query after every time I run fetch_array. I only want to have to make one query, because I may have to run the while() loop a whole lot of times, and that could possibly be a lot of queries. I was thinking maybe the pointer for the array has been set to the end and isn't set back to the start when I try fetch_array() again. I've tried running reset() on $array but that won't work either. Anybody have any idea as to how to fix this problem?