[Solar-talk] Trying to insert a date field into MySQL database

Kilbride, James P. James.Kilbride at gd-ais.com
Wed Dec 5 15:21:19 CST 2007


Folks,
 
Insert Problem Solved. He had a field problem so it's not a solar issue.
 
James Kilbride

________________________________

From: solar-talk-bounces at lists.solarphp.com
[mailto:solar-talk-bounces at lists.solarphp.com] On Behalf Of Cruz, Darwin
Sent: Wednesday, December 05, 2007 3:50 PM
To: solar-talk at lists.solarphp.com; solar at 3hex.com
Subject: [Solar-talk] Trying to insert a date field into MySQL database


I'm trying to figure out how to take a passed in date formatted as
'2007-12-31' and insert that into a MySQL database.
 
I've tried the following array set ups for my insert into database with
no luck:
 
    $eventInsert = array(
     'event_id'   => 'null',
     'event_summary' => $values['eventSummary'],
     'event_number'  => $values['eventNumber'],
     'event_type'  => $values['eventType'],
     'date'    => 'ADDDATE(\''.$values['eventDate'].'\', INTERVAL 31
DAY)',
     );
 
    $eventInsert = array(
     'event_id'   => 'null',
     'event_summary' => $values['eventSummary'],
     'event_number'  => $values['eventNumber'],
     'event_type'  => $values['eventType'],
     'date'    => $values['eventDate'],
     );
 
 
Everything else insert's fine but the date is just 0000-00-00 00:00:00
Is there some format I need to pass the date as so MySQL will recognize
the date field from Solar?
 
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman-mail3.webfaction.com/pipermail/solar-talk/attachments/20071205/88697bfa/attachment.html


More information about the Solar-talk mailing list