Inserting times into Oracle with PEAR DB
| From: | Shawn Coomey | Date: | Tue, 10 Feb 2004 14:47:13 +0000 |
| Subject: | Inserting times into Oracle with PEAR DB | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-10603@lists.php.net to get a copy of this message | ||
Hi folks-
I am trying to figure out how to insert a time into an Oracle 9i database
using PEAR DB. Here's an example of what I am trying to do:
<?php
$event['event_start'] = date("n/j/Y g:i A", $start_time);
$event['event_end'] = date("n/j/Y g:i A", $end_time);
$table_fields = array('EVENT_START', 'EVENT_END');
$table_values = array($event['event_start'], $event['event_end']);
$table_name = 'CALENDAR_EVENTS';
$sth = $dbh->autoPrepare($table_name, $table_fields, DB_AUTOQUERY_INSERT);
$inserter = $dbh->execute($sth, $table_values);
if (DB::isError($inserter)){
$error .= "Database Error: " . $inserter->getUserInfo();
}
?>
Problem is that Oracle keeps returning a "not a valid month" error upon
execution. Is there a way to call the Oracle TO_DATE() function from a pear
prepare/execute statement?
Thanks!
Shawn Coomey