intermittent failure of php date

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I maintain a site that is generating some strange behavior...

It's a custom built event registration app.

Events have event_dates that are stored in the MySQL db.

This code retrieves the event title and event date for display on the
registration acknowledgment page:

$q2 = "SELECT title, event_date, DATE_FORMAT(event_date, '%M %d, %Y') AS
formatted_event_date FROM events WHERE id =" . $eid . ";";
 $result = mysql_query($q2);
 if ($result) {
   $row = mysql_fetch_array($result);
   $title = $row['title'];

   if(strtotime($row['event_date'])) {
      $event_date = date("F m, Y", strtotime($row['event_date']));
   } else {
      $event_date = $row['formatted_event_date'];
   }

Sometimes, it doesn't work.

Every 3rd or 4th registration notification email comes through with an empty
value for event_date.

There are no other references to the variable $event_date.

It works most of the time.

There's no pattern I can see. I even tried to force it to show a date by
selecting a formatted date and displaying that if the original programmer's
strtotime failed.

Where do you look for help with intermittent failures of a date field in the
DB?


-- 
John Corry
PHP developer - 3by400, Inc
http://www.3by400.com

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux