Home >Backend Development >PHP Tutorial >How to use Oracle database in PHP (3)_PHP tutorial

How to use Oracle database in PHP (3)_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-21 16:05:38803browse

Use ORA to input data into the data table 'email_info'

When the user browses this script, a form consisting of name and email input fields is displayed; when the user adds the data and clicks submit, the script will Name and email are saved in the 'email_info' data table.

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 = Ora_Logon ("username","password");
if ($connection = = false){
echo Ora_ErrorCode($connection).": ".Ora_Error($connection)."
";
exit;
}

$cursor = Ora_Open ( $connection);
if ($cursor == false){
echo Ora_ErrorCode($connection).": ".Ora_Error($connection)."
";
exit;


$query = "insert into email_info values ​​('$fullname', '$email')";
$result = Ora_Parse ($cursor, $query);
if ($result == false){
echo Ora_ErrorCode($cursor).": ".Ora_Error($cursor)."
";
exit;
}

$result = Ora_Exec ($cursor);
if ($result == false){
echo Ora_ErrorCode($cursor).": ".Ora_Error($cursor)."
";
exit;
}

Ora_Commit ($connection);
Ora_Close ($cursor);
Ora_Logoff ($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> <
';
}

?>


By the way, this script must be saved as insert.php, because insert.php is specified in the calling page. form handler



http://www.bkjia.com/PHPjc/315644.html

www.bkjia.com

truehttp: //www.bkjia.com/PHPjc/315644.htmlTechArticleUse ORA to input data into the data table 'email_info'. When the user browses this script, a message consisting of name and email is displayed. A form composed of input fields; when the user adds data and clicks submit, the script...
Statement:
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