I have an oracle database, the format of it is:
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)
);
I am trying to add a set of data to it from a form, then display the data from the database to verify it has been added correctly. There does not seem to be any error when I add the data to the database, using the insert command. However I cannot display the data.
the date variables are in the format "DD-MM-YYYY", so I may need to use the TO_DATE function to convert to a correct Oracle date format, however I have not go this to work either. Does anyone know the problem with my code? I have included the code below...
<code>
<?php
$dbh = db_connect($database_user,$database_password,$database_name);
$stmt = ociparse($dbh,"insert into TRAVEL_REQUEST (request_id_sequence.nextval,$dbdirid,'$origin',
'$destination' ,$depart_date, '$purpose', '$justification', '$approval_status')"
ociexecute($stmt,OCI_DEFAULT);
$display = ociparse($dbh, "select * from TRAVEL_REQUEST"
ociexecute($display,OCI_DEFAULT);
while(ocifetch($display))
{
echo ociresult($display)."<br>\n";
}
ocilogoff($dbh);
?>
</code>
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)
);
I am trying to add a set of data to it from a form, then display the data from the database to verify it has been added correctly. There does not seem to be any error when I add the data to the database, using the insert command. However I cannot display the data.
the date variables are in the format "DD-MM-YYYY", so I may need to use the TO_DATE function to convert to a correct Oracle date format, however I have not go this to work either. Does anyone know the problem with my code? I have included the code below...
<code>
<?php
$dbh = db_connect($database_user,$database_password,$database_name);
$stmt = ociparse($dbh,"insert into TRAVEL_REQUEST (request_id_sequence.nextval,$dbdirid,'$origin',
'$destination' ,$depart_date, '$purpose', '$justification', '$approval_status')"
ociexecute($stmt,OCI_DEFAULT);
$display = ociparse($dbh, "select * from TRAVEL_REQUEST"
ociexecute($display,OCI_DEFAULT);
while(ocifetch($display))
{
echo ociresult($display)."<br>\n";
}
ocilogoff($dbh);
?>
</code>