hellonoko Posted November 16, 2007 Share Posted November 16, 2007 My code (bottom of page) returns the following errors in WAMP with error_reporting(E_ALL) set. However without error reporting the code works fine. On the server however. I get no error reporting and code does not function past echoing "Recurring Events:" Any suggestions? Recurring Events: Notice: Use of undefined constant eventdate - assumed 'eventdate' in C:\www\NEWBASSOBESE\bassobese\schedule.php on line 26 10-10-2009 Notice: Use of undefined constant event - assumed 'event' in C:\www\NEWBASSOBESE\bassobese\schedule.php on line 32 Event One. Recurring. Notice: Use of undefined constant eventdate - assumed 'eventdate' in C:\www\NEWBASSOBESE\bassobese\schedule.php on line 26 11-30--0001 Notice: Use of undefined constant event - assumed 'event' in C:\www\NEWBASSOBESE\bassobese\schedule.php on line 32 Updated Event Events: <?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); $event_date = $row[eventdate]; $dateTime = new DateTime($event_date); 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 Share on other sites More sharing options...
kenrbnsn Posted November 16, 2007 Share Posted November 16, 2007 When strings are used as indices of an array they MUST be quoted: <?php $dateTime = new DateTime($row['eventdate']); ?> Ken Quote Link to comment Share on other sites More sharing options...
hellonoko Posted November 16, 2007 Author Share Posted November 16, 2007 Did not realize that DateTime() uses an array? Thanks. Quote Link to comment Share on other sites More sharing options...
premiso Posted November 16, 2007 Share Posted November 16, 2007 Did not realize that DateTime() uses an array? Thanks. It doesn't, that is an index of an array. Indexes of an array can contain values much like a variable. A multi-dimensional array, which this does not seem to be, is where an index of an array will contain another array. Hope that makes sense. 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.