Teach you how to use Oracle database in PHP (4)
Use OCI to input data into the data table 'email_info'
Same as above, but written in OCI
Related php code:
if ($submit == "click"){
// The submit button was clicked!
// Get the input for fullname and email then store it in the database.
PutEnv("Oracle_SID=ORASID");
$connection = OCILogon ("username","passWord");
if ($connection == false){
echo OCIError($connection)."
";
exit;
}
$query = "insert into email_info values ('$fullname', '$email')";
$cursor = OCiparse ($connection, $query);
if ($cursor == false){
echo OCIError($cursor)."
";
exit;
}
$result = OCIExecute ($cursor);
if ($result == false){
echo OCIError($cursor)."
";
exit;
}
OCICommit ($connection);
OCILogoff ($connection);
}
else{
echo '
<FORM action=insert.php method=post>
Please enter your name
<INPUT name=fullname></INPUT>
Please enter your email address
<INPUT name=email></INPUT>
<INPUT name=submit type=submit value=click></INPUT> <
</FORM>
';
}
?>
By the way, this script must be saved as insert.php, because insert.php is specified as the form handler in the page called.
The above has introduced teaching you how to use Oracle database in PHP 4), including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.