I have this code:
$end_date = time(); $year = 2002; $month = 4; $monthi = $month + 1; $time = SecondsInMonth($month, $year); $time_i = SecondsInMonth($monthi, $year); $query = "SELECT * FROM news WHERE date < $time_i AND date > $time ORDER BY id"; $result = mysql_query($query); $num_results = mysql_num_rows($result);
echo '<tr><td><h3>'; echo date('F', mktime(12, 0, 0, ++$month)); echo '</h3></td>'; echo '<td>'; for ($i=0; $i < $num_results; $i++) { $row = mysql_fetch_array($result); echo '<a href="news_temp.php?id='; echo $row['id']; echo '">: '; echo $row['title']; if(!$row['date'] == 0){ echo ' - '; echo date("d-M-y", $row['date']); } echo ' :</a><br>'; } echo '</td></tr>'; if($month == 12){ $year++; $month = 0; } And I am not sure how to loop it. It Currently prints like this:
I am not sure how to get the newest records to display at the top. Rather
than the bottom. There is no looping yet as I am not sure how to do it. Can I
reverse to results array or something? Every month is in a new set of
cells.
Thanks,
|
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php