Teach you how to use Oracle database in PHP 4)

WBOY
Release: 2016-08-08 09:33:40
Original
709 people have browsed it

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!