phpとmysqlを使用して1つのクエリのみを実行し、次に2つのwhileループを実行して異なる結果を得ることができますか?私
//this is the query
$qry_offers = mysql_query("SELECT * FROM offers ORDER BY offer_end ASC");
最初のループで、「end_date」が今日以下の結果を表示したい
<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 -->
2番目のループでは、「end_date」が今日よりも大きい結果を表示したいと思います。
//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 -->