Ok I have this system that displays sermons from a MYSQL db. The problem is that if that date I place for the sermon is after the 13 of the month of Dec. it places it in the list before july! It's whacked. If I put it the 13 or sooner then it's fine, comes after Nov.
You can see this problem here, down at the bottom in Dec. of 2007 and right now I'm having problems with Dec. of 08 since the current one should be the 14th since it was sun. not the 13, but since the 14 gets screwed up I can't:
http://fscconline.org/index.php?opti...d=57&Itemid=88
This is the code I'm using to display the dates:
PHP Code:$query1 = "SELECT *,
IF (
month_lookup.month_num < MONTH( CURDATE( ) )
OR month_lookup.month_num = MONTH( CURDATE( ) )
AND sermons.day < DAYOFMONTH( CURDATE( ) ) , CONCAT( sermons.month, ' ' ) , sermons.month
) display_month,
IF (
month_lookup.month_num < MONTH( CURDATE( ) )
OR month_lookup.month_num = MONTH( CURDATE( ) )
AND sermons.day < DAYOFMONTH( CURDATE( ) ) , month_lookup.month_num+12, month_lookup.month_num
)*32+day prio
FROM month_lookup, sermons
WHERE sermons.month = month_lookup.month
ORDER BY sermons.year DESC, prio DESC";
$i = 1;
$lastmonth = '';
$lastyear = '';
$r = mysql_query ($query1);
$i2 = 0;
while ($row = mysql_fetch_array ($r)) {
$i++;
$i2++;
$day = $row['day'];
$month = $row['month'];
$display_month = $row['display_month'];
$y1 = $row['year'];
if($lastmonth != $month OR $lastyear != $y1)
{
$lastmonth = $month;
$lastyear = $y1;
if ($i2 > 1) {
echo "<tr><td> </td></tr>";
}
echo "<tr><td colspan=4 bgcolor=#96B831><strong> $display_month $y1</strong></td></tr>";
$i = "0";
}



Reply With Quote
Bookmarks