Use Mysql Result Twice

If you used loop for mysql result, you cannot use a loop again unless you set the pointer again.

You need mysql_data_seek() to set the pointer.

[php]
$result = mysql_query("SELECT * FROM my_table");
while($row = mysql_fetch_assoc($result)) {
// inside the loop
}
[/php]

Here the pointer is set as a 0.

[php]
mysql_data_seek($result, 0); // set the pointer of the result set back to the beginning.
while($row2 = mysql_fetch_assoc($result)) {
// inside the loop
}
[/php]