当前位置: 编程技术>php
本页文章导读:
▪如何在PHP中使用Oracle数据库(4)
利用OCI向数据表 'email_info' 输入数据 同上,只不过用OCI来写 相关PHP代码: if ($submit == "click"){ // The submit button was clicked! // Get the input for fullname and email then store it in the database. PutEnv(".........
▪人大复印资料处理程序_补充篇
说明: 1、人大复印资料的处理是本人自己使用的一套程序,因为看到论坛上有关于全文检索的讨论所以就不顾编程水平的菜鸟级差,也将其公布于公。 2、人大复印全文光盘资料在各大学.........
▪如何在PHP中使用Oracle数据库(3)
利用 ORA 向数据表 'email_info' 输入数据 当用户浏览这段脚本时,显示一个由姓名、email输入域组成的表单;当用户添好数据点击提交时,脚本程序将把这姓名、email保存到'email_info'数据表中。.........
[1]如何在PHP中使用Oracle数据库(4)
来源: 互联网 发布时间: 2013-11-30
利用OCI向数据表 'email_info' 输入数据
同上,只不过用OCI来写
相关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>
请输入姓名
<INPUT name=fullname></INPUT>
请输入 Email 地址
<INPUT name=email></INPUT>
<INPUT name=submit type=submit value=click></INPUT>
</FORM>
';
}
?>
对了,这段脚本必须存为insert.php,因为在调用的页面中指定insert.php为表单处理程序
同上,只不过用OCI来写
相关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>
请输入姓名
<INPUT name=fullname></INPUT>
请输入 Email 地址
<INPUT name=email></INPUT>
<INPUT name=submit type=submit value=click></INPUT>
</FORM>
';
}
?>
对了,这段脚本必须存为insert.php,因为在调用的页面中指定insert.php为表单处理程序
[2]人大复印资料处理程序_补充篇
来源: 互联网 发布时间: 2013-11-30
说明:
1、人大复印资料的处理是本人自己使用的一套程序,因为看到论坛上有关于全文检索的讨论所以就不顾编程水平的菜鸟级差,也将其公布于公。
2、人大复印全文光盘资料在各大学图书馆应该可以取得。
######config.php3
<?
$hostname = "localhost";
$dbusername = "";
$dbname='';
$dbpassword = "";
function indexfile($index_file,$index_title,$index_describe=""){
global $added;
if($index_file==""){
$index_file="\index\temp.html";
}
elseif(file_exists($index_file)){
$added=1;
copy($index_file,$index_file.".bak");
}
$fp_i=fopen($index_file,'w+');
fputs($fp_i, "<html><head><title>$index_title</title></head><body>rn");
fputs($fp_i, "<h5>$index_title</h5>rn");
//$dte_created=date('Y-m-d H:i:s');
fputs($fp_i, "<font color='Maroon' face='楷体' size=1>$index_describe");
//查询日期:$dte_created</font><hr>rn");
//fputs($fp_i,"<table>rn");
return $fp_i;
}
function mysql_error_exit($msg) {
$errno = mysql_errno();
$error = mysql_error();
echo '<html><head><title>数据库错误</title></head><body>';
echo $msg;
echo "<br>错误: ($errno) $error<br>";
echo '</body></html>';
exit();
}
function xueroom_error_exit($msg,$page) {
echo "<HTML><HEAD><TITLE>严重错误 </TITLE></HEAD>";
echo "<BODY><table align=center cellpadding=3 cellspacing=0 width=420 >";
echo "<TH colspan=2 bgcolor=726cc5>";
echo"<font color=white face=Arial,Helvetica size=2><CENTER>";
echo $msg."<BR>";
echo "<TR><TD align=center>请致信xueroom@263.net,与管理员联系。";
echo"<BR><TR><TD align=center><A HREF = ".$page.">返回 </A>";
echo '</body></html>';
exit -1;
}
function xueroom_message($msg) {
echo '<table>';
echo '<tr><td>';
echo "$msg";
echo '</td></tr>';
echo '</table>';
}
?>
#################### 数据库结构:
CREATE TABLE artical (
artical_id int(6) NOT NULL auto_increment,
resource_id varchar(10) NOT NULL,
origin_periodical varchar(60) binary NOT NULL,
date_pub datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
artical_author varchar(50) binary NOT NULL,
artical_title varchar(100) binary NOT NULL,
artical_data longblob NOT NULL,
artical_type varchar(6),
artical__size varchar(10),
date_reprinted datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
read_count int(10) DEFAULT '0' NOT NULL,
catalog tinyint(4) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (artical_id),
KEY artical_title (artical_title),
KEY artical_author (artical_author),
KEY origin_periodical (origin_periodical),
KEY catalog (catalog),
KEY resource_id (resource_id)
);
1、人大复印资料的处理是本人自己使用的一套程序,因为看到论坛上有关于全文检索的讨论所以就不顾编程水平的菜鸟级差,也将其公布于公。
2、人大复印全文光盘资料在各大学图书馆应该可以取得。
######config.php3
<?
$hostname = "localhost";
$dbusername = "";
$dbname='';
$dbpassword = "";
function indexfile($index_file,$index_title,$index_describe=""){
global $added;
if($index_file==""){
$index_file="\index\temp.html";
}
elseif(file_exists($index_file)){
$added=1;
copy($index_file,$index_file.".bak");
}
$fp_i=fopen($index_file,'w+');
fputs($fp_i, "<html><head><title>$index_title</title></head><body>rn");
fputs($fp_i, "<h5>$index_title</h5>rn");
//$dte_created=date('Y-m-d H:i:s');
fputs($fp_i, "<font color='Maroon' face='楷体' size=1>$index_describe");
//查询日期:$dte_created</font><hr>rn");
//fputs($fp_i,"<table>rn");
return $fp_i;
}
function mysql_error_exit($msg) {
$errno = mysql_errno();
$error = mysql_error();
echo '<html><head><title>数据库错误</title></head><body>';
echo $msg;
echo "<br>错误: ($errno) $error<br>";
echo '</body></html>';
exit();
}
function xueroom_error_exit($msg,$page) {
echo "<HTML><HEAD><TITLE>严重错误 </TITLE></HEAD>";
echo "<BODY><table align=center cellpadding=3 cellspacing=0 width=420 >";
echo "<TH colspan=2 bgcolor=726cc5>";
echo"<font color=white face=Arial,Helvetica size=2><CENTER>";
echo $msg."<BR>";
echo "<TR><TD align=center>请致信xueroom@263.net,与管理员联系。";
echo"<BR><TR><TD align=center><A HREF = ".$page.">返回 </A>";
echo '</body></html>';
exit -1;
}
function xueroom_message($msg) {
echo '<table>';
echo '<tr><td>';
echo "$msg";
echo '</td></tr>';
echo '</table>';
}
?>
#################### 数据库结构:
CREATE TABLE artical (
artical_id int(6) NOT NULL auto_increment,
resource_id varchar(10) NOT NULL,
origin_periodical varchar(60) binary NOT NULL,
date_pub datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
artical_author varchar(50) binary NOT NULL,
artical_title varchar(100) binary NOT NULL,
artical_data longblob NOT NULL,
artical_type varchar(6),
artical__size varchar(10),
date_reprinted datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
read_count int(10) DEFAULT '0' NOT NULL,
catalog tinyint(4) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (artical_id),
KEY artical_title (artical_title),
KEY artical_author (artical_author),
KEY origin_periodical (origin_periodical),
KEY catalog (catalog),
KEY resource_id (resource_id)
);
[3]如何在PHP中使用Oracle数据库(3)
来源: 互联网 发布时间: 2013-11-30
利用 ORA 向数据表 'email_info' 输入数据
当用户浏览这段脚本时,显示一个由姓名、email输入域组成的表单;当用户添好数据点击提交时,脚本程序将把这姓名、email保存到'email_info'数据表中。
相关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 = 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>
请输入姓名
<INPUT name=fullname></INPUT>
请输入Email地址
<INPUT name=email></INPUT>
<INPUT name=submit type=submit value=click></INPUT>
</FORM>
';
}
?>
对了,这段脚本必须存为insert.php,因为在调用的页面中指定insert.php为表单处理程序
当用户浏览这段脚本时,显示一个由姓名、email输入域组成的表单;当用户添好数据点击提交时,脚本程序将把这姓名、email保存到'email_info'数据表中。
相关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 = 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>
请输入姓名
<INPUT name=fullname></INPUT>
请输入Email地址
<INPUT name=email></INPUT>
<INPUT name=submit type=submit value=click></INPUT>
</FORM>
';
}
?>
对了,这段脚本必须存为insert.php,因为在调用的页面中指定insert.php为表单处理程序
最新技术文章: