I want to use the same data sets in two while loops. In the example below I am querying the database twice for the same info to use my while loop:
$sql = "select * from table_1";
$result = mysql_query($sql);
while($resultset = mysql_fetch_array($result)){
// code would go here
}
$sql2 = "select * from table_1";
$result2 = mysql_query($sql2);
while($resultset2 = mysql_fetch_array($result2)){
// code would go here
}
I would want to do something like this however:
$sql = "Select * from table_1";
$result = mysql_query($sql);
$resultset = mysql_fetch_array($result);
while($resultset){
//code goes here
}
while($resultset){
//code does something else with the same resultset here
}
I've tried this and it doesn't work as I want it to. Any ideas how to do this?
Thanks!