is it possible to run only one query using php & mysql and then do two while loops with different results. i
//this is the query
$qry_offers = mysql_query("SELECT * FROM offers ORDER BY offer_end ASC");
in the first loop, i want to show any result which has an "end_date" less or equal than today
<div id="current">
<?
while($row_offers = mysql_fetch_assoc($qry_offers)) {
if ( (date("Y-m-d H:i:s")) <= ($row_offers['offer_end']) ) {
echo '<li><a href="#">'.$row_offers['offer_name'].'</a></li>';
}
}
?>
</div><!-- END OF CURRENT -->
in the second loop, i want to show any result which has an "end_date" greater than today
//this is where i would have the 2n while loop
<div id="inactive">
<?
while($row_offers = mysql_fetch_assoc($qry_offers)) {
if ( (date("Y-m-d H:i:s")) > ($row_offers['offer_end']) ) {
echo '<li><a href="#">'.$row_offers['offer_name'].'</a></li>';
}
}
?>
</div><!-- END OF INACTIVE -->
mysql_field_seek($qry_offers,0)before second loop but I prefer Ansrew's answer!