Loading...
  所在位置:论坛首页 -> ┈┋电脑网络技术区┋┈ -> 莱鸟的电脑问题 -> 如何在PHP中使用Oracle数据库(4)
标题:如何在PHP中使用Oracle数据库(4)收藏 编辑 删除 楼主 | 上一篇 下一篇
冰心雨
等级:精灵
权限:管理员
积分:811
金钱:18382
声望:659
经验:568
发帖数:5149
注册:2006年8月5日
资料 短消息2008-7-19 0:15:35

利用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为表单处理程序
 
 
 
 
 
 
 

2008-7-19 0:15:35 顶部
第1页 共页 共0个回复     <<    >>    
 快速回复
  • 支持UBB,HTML标签

  • 高级回复

  • 操作选项:评分 加精 解精 奖惩 设专题 设公告 解公告 固顶 总固顶 解固顶 结帖 解结帖 锁帖 解锁 移帖 删帖
      首页 | 购买指南 | 商业版本 | 虚拟主机 | 特色介绍 | 下载中心 | 支付方式
    Copyright 2004-2008 BBSGood.com Powered By: BBSGood.Speed Version 5.0
      咨询电话:0575-85513832、0575-85513825(传真)、7*24小时咨询服务:13606552007 不良信息举报中心 浙ICP备05029817号
      业务QQ:38958768、客服QQ1:415896239、客服QQ2:343896043、MSN:jccsxx@hotmail.com