如何在PHP中使用Oracle數(shù)據(jù)庫(kù)(4)
更新時(shí)間:2006年10月09日 00:00:00 作者:
利用OCI向數(shù)據(jù)表 'email_info' 輸入數(shù)據(jù)
同上,只不過用OCI來寫
相關(guān)PHP代碼:
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>
請(qǐng)輸入姓名
<INPUT name=fullname></INPUT>
請(qǐng)輸入 Email 地址
<INPUT name=email></INPUT>
<INPUT name=submit type=submit value=click></INPUT>
</FORM>
';
}
?>
對(duì)了,這段腳本必須存為insert.php,因?yàn)樵谡{(diào)用的頁(yè)面中指定insert.php為表單處理程序
同上,只不過用OCI來寫
相關(guān)PHP代碼:
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>
請(qǐng)輸入姓名
<INPUT name=fullname></INPUT>
請(qǐng)輸入 Email 地址
<INPUT name=email></INPUT>
<INPUT name=submit type=submit value=click></INPUT>
</FORM>
';
}
?>
對(duì)了,這段腳本必須存為insert.php,因?yàn)樵谡{(diào)用的頁(yè)面中指定insert.php為表單處理程序
您可能感興趣的文章:
- PHP下的Oracle客戶端擴(kuò)展(OCI8)安裝教程
- Win7 64位系統(tǒng)下PHP連接Oracle數(shù)據(jù)庫(kù)
- windwos下使用php連接oracle數(shù)據(jù)庫(kù)的過程分享
- thinkphp中連接oracle時(shí)封裝方法無法用的解決辦法
- 一個(gè)php導(dǎo)出oracle庫(kù)的php代碼
- 用PHP調(diào)用Oracle存儲(chǔ)過程的方法
- 如何在PHP中使用Oracle數(shù)據(jù)庫(kù)(6)
- 如何在PHP中使用Oracle數(shù)據(jù)庫(kù)(5)
- 如何在PHP中使用Oracle數(shù)據(jù)庫(kù)(3)
- 如何在PHP中使用Oracle數(shù)據(jù)庫(kù)(1)
- 操作Oracle的php類
- php+oracle 分頁(yè)類
- 一個(gè)oracle+PHP的查詢的例子
- PHP處理Oracle的CLOB實(shí)例
相關(guān)文章
PHP文件注釋標(biāo)記及規(guī)范小結(jié)
PHP文件注釋標(biāo)記及規(guī)范小結(jié),php開發(fā)的朋友可以收藏下,方便以后使用,讓我們的代碼更專業(yè)2012-04-04
用Php實(shí)現(xiàn)鏈結(jié)人氣統(tǒng)計(jì)
用Php實(shí)現(xiàn)鏈結(jié)人氣統(tǒng)計(jì)...2006-10-10
利用PHP實(shí)現(xiàn)與ASP Banner組件相似的類
利用PHP實(shí)現(xiàn)與ASP Banner組件相似的類...2006-10-10
vBulletin HACK----顯示話題大小和打開新窗口于論壇索引頁(yè)
vBulletin HACK----顯示話題大小和打開新窗口于論壇索引頁(yè)...2006-10-10

