I am having problems adding records to my database, the insert statement seems to work ok, but I have an error when the execute command is reached.
does anyone know where my problem is?
<?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);
?>
does anyone know where my problem is?
<?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);
?>