I am getting an error when inserting data into my Oracle Database, the error occurs at the execute stage, I have included the model of my database (very simple) and the insert code. Can anyone see why it fails at this stage?
SQL
drop table travel_request;
create table travel_request
(
request_id number(5) not null,
dbdirid number(15) not null,
origin varchar2(128) not null,
destination varchar2(128) not null,
depart_date date not null,
return_date date,
purpose varchar2(255) not null,
justification varchar2(255),
approval_status char(1));
show errors;
alter table travel_request add primary key(request_id);
-- Sequence to generate request_id values
drop sequence request_id_sequence;
create sequence request_id_sequence increment by 1 start with 1;
show errors;
=====
<?php
____//try first to connect to the database. if we can't then end
_$dbh = db_connect($database_user,$database_password,$database_name);
$stmt = OCIparse($dbh,"insert into TRAVEL_REQUEST values(request_id_sequence.nextval,$dbdirid,'$origin', '$destination' ,
to_date($depart_date,'DD-MM-YYYY:hh24:mi:ss'),to_date($return_date,'DD-MM-YYYY:hh24:mi:ss'), '$purpose', '$justification',
_'$approval_status')");
_if($stmt==false)
{
____echo OCIError($stmt)."<br>";
__echo "error in insert";
__exit;
_}
_$execute=OCIexecute($stmt,OCI_DEFAULT);
_ocicommit($dbh);
_if($execute==false)
{
____echo OCIError($execute)."<br>";
__echo "error in execute";
__exit;
}
___OCIlogoff($dbh);
?>