PEAR::DB and autoPrepare with dates (Oracle)
| From: | Shawn Coomey | Date: | Tue, 24 Feb 2004 17:31:04 +0000 |
| Subject: | PEAR::DB and autoPrepare with dates (Oracle) | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-10905@lists.php.net to get a copy of this message | ||
Hi folks-
I am trying to perform an autoPrepare() update on a date column in Oracle 9i.
Seems to be giving me some trouble with the date formatting. Here; an example
of what I am trying to do:
<?php
$start = = "TO_DATE(" . date("m/d/Y g:i A", strtotime($start_time)) . ",
'MM/DD/YYYY HH:MI AM')";
$end = = "TO_DATE(" . date("m/d/Y g:i A", strtotime($end_time)) . ",
'MM/DD/YYYY HH:MI AM')";
$table_fields = array('event_start', 'event_end');
$table_values = array($start', $end');
$table_name = 'calendar_events';
$sth = $dbh->autoPrepare($table_name, $table_fields, DB_AUTOQUERY_UPDATE,
'event_id = ' . $event_id');
$dbh->execute($sth, $table_values);
?>
But this throws the following Oracle error:
[nativecode=ORA-01858: a non-numeric character was found where a numeric was
expected]
How do I format the date for autoPrepare to work?
TIA-
Shawn