网页功能: 加入收藏 设为首页 网站搜索  
如何在PHP中使用Oracle数据库(4)
发表日期:2004-07-23作者:[转贴] 出处:  

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

我来说两句】 【加入收藏】 【返加顶部】 【打印本页】 【关闭窗口
中搜索 如何在PHP中使用Oracle数据库(4)
本类热点文章
  用PHP验证邮箱是否真实有效
  PHP5的变化与PHP6展望
  用户IP、浏览器、操作系统
  oracle资料库函式库
  oracle资料库函式库
  基于PHP的聊天室(二)
  基于PHP的聊天室(二)
  php调用mysql存储过程和函数的方法
  正则表达式在网络编程中的运用
  专家预言:PHP将比Java更受欢迎
  高效的中文字符串截取函数
  高效的中文字符串截取函数
最新分类信息我要发布 
最新招聘信息

关于我们 / 合作推广 / 给我留言 / 版权举报 / 意见建议 / 广告投放  
Copyright ©2003-2024 Lihuasoft.net webmaster(at)lihuasoft.net
网站编程QQ群   京ICP备05001064号 页面生成时间:0.011