Styles2304 Posted September 12, 2007 Share Posted September 12, 2007 I'm trying to have the news section spit out the date of the event that it is displaying in a prettier format. For example, displaying "2007-09-27" as "September 27" . . .however, it won't spit out anything but todays date. Here is what I have at the moment: <?php include "conn.inc.php"; $query = "SELECT Title, Body FROM CalendarEvents WHERE ((EventDate >= CURRENT_DATE) AND (Validate = 1)) ORDER BY EventDate LIMIT 1"; $result = mysql_query($query,$link) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $Title = $row['Title']; $Body = $row['Body']; $EventDate = $row['EventDate']; $currentTimeStamp = strtotime("$EventDate"); $EventMonth = date("F", $currentTimeStamp); $EventDay = date("j", $currentTimeStamp); } ?> <html> <head> <title>New Covenant Fellowship</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL=StyleSheet HREF="style.css" TYPE="text/css"> <script src="linkframe.js"> </script> </head> <body bgcolor="ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <center> <table width="100%" cellpadding="0" cellspacing="2" border="0"> <td width="*" valign="top"> <center> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td valign="top" bgcolor="2b496d" align="center"> <font face="verdana" color="FFFFFF"> <?php echo $EventMonth . ' ' . $EventDay . ' - ' . $Title; ?> </font> </td> </tr> <tr> <td valign="top" height="130" align="center"> <?php echo $Body; ?> </td> </tr> </table> </td> </center> </table> </center> I've also tried doing things similar to $EventDay = date("j", $EventDate); . . . that yields the same output. Can anyone give me a hand? Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 12, 2007 Share Posted September 12, 2007 It sounds like $EventDate is empty. What does it say if you do: while ($row = mysql_fetch_array($result)) { print_r($row); } Quote Link to comment Share on other sites More sharing options...
Styles2304 Posted September 12, 2007 Author Share Posted September 12, 2007 Oy, I'm an idiot. I didn't call for EventDate in the query . . . I swear I try to figure this stuff out on my own before I post . . . Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 12, 2007 Share Posted September 12, 2007 Ah, I didn't even read your SQL myself. Sorry Well glad you caught it! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.