<?php
// require('db-include.inc');
// Oracle environment variables:
putenv("ORACLE_HOME=/oracle/app/oracle/product/8.1.7");
//attempt logon
$connection = ocilogon("user", "pw", "machine");
//$curs = ora_open($conn);
if (!$connection){ //connection failed
// as we don't have a connection yet the error is stored in the
// module global error-handle
$err = OCIError();
print ("<b>dump the whole error:</b><p>");
var_dump($err);print ("<p>"); //dump the whole error
print "\nError code = " . $err[code];
print "\nError message = " . $err[message];
}
else{
echo "connected to database" ;?><br><?PHP
}
$firstNm = $POST['first'];
$lastNm = $POST['last'];
echo $POST['first'];?><br><?PHP
echo $POST['last'];?><br><?PHP
// Drop old table...
$s = OCIParse($connection, "drop table tab2");
OCIExecute($s, OCI_DEFAULT);
// Create new table...
$s = OCIParse($connection, "create table tab2 (first varchar2(30), last varchar2(30))");
OCIExecute($s, OCI_DEFAULT);
// Insert data into table...
$s = OCIParse($connection, "insert into tab2 values ('$firstNm', '$lastNm')");
OCIExecute($s, OCI_DEFAULT);
// Select Data...
$s = OCIParse($connection, "select * from tab2");
OCIExecute($s, OCI_DEFAULT);
while (OCIFetch($s)) {
echo "COL1=" . ociresult($s, "FIRST") .
", COL2=" . ociresult($s, "LAST") . "\n";
}
OCICommit($connection); // Commit to save changes
ocilogoff($connection); //close connection
?>