The field in the DB is defined as type date. I've had several event registrations for an upcoming event come through. THe event date is '2010-01-27'. 2 of the 5 event registrations contained empty values for the date. wtf? On Mon, Jan 18, 2010 at 10:23 AM, John Corry <jcorry.lists@xxxxxxxxx> wrote: > 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 > > -- John Corry PHP developer - 3by400, Inc http://www.3by400.com