hellonoko Posted November 16, 2007 Share Posted November 16, 2007 My below code works fine running off WAMP however when I upload it to my host (globat) It fails after echoing "Recurring Events:" No errors even with all error reporting turned on. Not sure if this is a problem with my host since they seem to have allot of trouble telling me if they have the DateTime and date_format functions installed... Is there an alternative way to do what I am doing? Change the format of how date is stored in the database YYYY-MM-DD. Or is there something wrong with my code? Thanks for your time. <?php error_reporting(E_ALL); include 'dbconnect.php'; // echos recurring events first. $query = "SELECT * FROM schedule WHERE recurring = 'TRUE'"; $result = mysql_query($query); $rows = mysql_num_rows($result); echo "<td align='center' valign='top'>"; echo "<div style='overflow:auto; height:320'>"; echo "<br><br>Recurring Events:<br><br>"; for ($i=0; $i <$rows; $i++) { $row = mysql_fetch_array($result); $dateTime = new DateTime($row['eventdate']); echo date_format( $dateTime, 'm-d-Y' ); echo "<br>"; echo $row['event']; echo "<br>"; //echo $row[recurring]; echo "<br>"; echo "<br>"; } // echos one time events $query = "SELECT * FROM schedule WHERE recurring = 'FALSE'"; $result = mysql_query($query); $rows = mysql_num_rows($result); echo "Events:<br><br>"; for ($i=0; $i <$rows; $i++) { $row = mysql_fetch_array($result); $dateTime = new DateTime($row['eventdate']); echo date_format( $dateTime, 'm-d-Y' ); echo "<br>"; echo $row[event]; echo "<br>"; //echo $row[recurring]; echo "<br>"; echo "<br>"; } echo "</div></td>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/77660-alternative-for-new-datetime-and-date_format-functions/ Share on other sites More sharing options...
axiom82 Posted November 17, 2007 Share Posted November 17, 2007 http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html Quote Link to comment https://forums.phpfreaks.com/topic/77660-alternative-for-new-datetime-and-date_format-functions/#findComment-393273 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.