当前位置:  编程技术>php
本页文章导读:
    ▪社区(php&&mysql)一       function cook_cooloff(){     global $PHP_SELF,$aid,$pgno;     setcookie("OPEN_LIST",0,time()+ 31536000);     Header("Location:$PHP_SELF?aid=$aid&pgno=$pgno");     exit; } //========================================================.........
    ▪如何在PHP中使用Oracle数据库(6)       利用OCI列出全部数据表'email_info'中的数据 同上,只不过用OCI来写  相关PHP代码: PutEnv("ORACLE_SID=ORASID"); $connection = OCILogon ("username","password"); if ($connection == false){   echo OCIError($connection)." ";  .........
    ▪如何在PHP中使用Oracle数据库(5)       利用ORA列出全部数据表'email_info'中的数据 下面,我们将逐条读出数据库的内容,并以html表格形式显示'email_info'数据表中的数据  相关PHP代码: PutEnv("ORACLE_SID=ORASID"); $connection = Ora_Logon ("userna.........

[1]社区(php&&mysql)一
    来源: 互联网  发布时间: 2013-11-30
function cook_cooloff(){
    global $PHP_SELF,$aid,$pgno;
    setcookie("OPEN_LIST",0,time()+ 31536000);
    Header("Location:$PHP_SELF?aid=$aid&pgno=$pgno");
    exit;
}
//===============================================================
function cook_coolon(){
    global $PHP_SELF,$aid,$pgno;
    setcookie("OPEN_LIST",1,time()+ 31536000);
    Header("Location:$PHP_SELF?aid=$aid&pgno=$pgno");
    exit;
}
function check_mail($semail)
{
    $str=strchr($semail,'@');   
    if ($str=="") return false;
    $str=strchr($semail,".");
    if ($str=="") return false;
    return true;
}
//================================================================
function addhitviews($sid,$rid) {
    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);  
    if($sid==$rid)     $qsql="SELECT * from bbs_subj where id='$rid'";
    else $qsql="SELECT * from bbs_docs where id='$rid'";
    $rs=mysql_db_query($sql['db'],$qsql);
    $row=mysql_fetch_array($rs);
    $views=$row['views'];
    $views++;
    if($sid==$rid)     $qsql="UPDATE bbs_subj SET views='$views' where id='$rid'";
    else $qsql="UPDATE bbs_docs SET views='$views' where id='$rid'";

    mysql_db_query($sql['db'],$qsql);
}

//===============================================================
function mail_list(){
    global $PHP_SELF,$HTTP_HOST,$email;
    global $aid,$sid,$rid;
    global $way1,$way2;

    if(check_mail($email)) {
    $mailtype=0; //璹綷
    if(strlen($way2)) $mailtype=1;//

    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);  
    if($mailtype==0) { //璹綷
        $qsql="SELECT * from bbs_sml where sid='$sid' AND email='$email'";
        $rs=mysql_db_query($sql['db'],$qsql);
        if(mysql_num_rows($rs)==0) { //临⊿
          $qsql="INSERT INTO  bbs_sml (sid,email) values('$sid','$email')";
          $rs=mysql_db_query($sql['db'],$qsql);
        } else {
          echo "
          <script language=javascript>
          alert('竒,ぃ惠狡');
          </script>
         ";     
        }
    } else { //璹綷
        $qsql="SELECT * from bbs_sml where sid='$sid' AND email='$email'";
        $rs=mysql_db_query($sql['db'],$qsql);
        if(mysql_num_rows($rs) > 0) { //虫
          $qsql="DELETE FROM  bbs_sml where sid='$sid' AND email='$email'";
          $rs=mysql_db_query($sql['db'],$qsql);
        } else {
          echo "
          <script language=javascript>
            alert('﹟ゼ虫ず!');
          </script>
         ";

        }

    }

    } else {
        echo "
          <script language=javascript>
              alert('E-mailΑ岿粇');
          </script>
         ";  
    }
    echo "
          <script language=javascript>
          document.location='$PHP_SELF?proc=view&aid=$aid&sid=$sid&rid=$rid'
          </script>
         ";  
}

//===============================================================
function Send_the_doc_to_mail_list($aid,$sid,$rid){
    global $PHP_SELF,$HTTP_HOST;
    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);  
    if($sid==$rid)     $qsql="SELECT * from bbs_subj where id='$sid'";
    else $qsql="SELECT * from bbs_docs where id='$rid'";

    $rs=mysql_db_query($sql['db'],$qsql);
    $row=mysql_fetch_array($rs);
    $poster=$row['poster'];
    $banner=$row['banner'];
    $body=$row['body'];

    $subj=$c_poster."ㄓ璹綷ゅ彻";
    $message=":$poster\n";
    $message.="ゅ彻夹肈:$banner\n";
    $message.="ゅ彻ず甧:$body\n";
    $message.="\nㄤ闽ゅ彻叫 http://$HTTP_HOST$PHP_SELF?proc=view&aid=$aid&sid=$sid&rid=$rid\n";
    $message.="<<舧>>\n";
    $mailfrom="From:Magic Jerry";


    $qsql="SELECT * from bbs_sml where sid='$sid'";
    $rs=mysql_db_query($sql['db'],$qsql);
    while($row=mysql_fetch_array($rs)) { //mail_list
        $email=$row['email'];
        mail($email,$subj,$message,$mailfrom);
        echo $email;
    }
    //盚倒恨瞶
    $qsql="SELECT * from bbs_area where id='$aid'";
    $rs=mysql_db_query($sql['db'],$qsql);
    $row=mysql_fetch_array($rs);
    $email=$row['email'];
    $banner=$row['banner'];

    mail($email,"$banner 穝秈ゅ彻",$message,$mailfrom);


}
//===============================================================
function mail_friend(){
    global $PHP_SELF,$HTTP_HOST,$c_email,$c_poster,$frmail;
    global $aid,$sid,$rid;
    if(check_mail($frmail)) {
    $DROOT=getenv('DOCUMENT_ROOT');
    include("sql.php3");
    $db=mysql_connect($sql['host'], $sql['user'] , $sql['passwd']);
    if($sid==$rid) {  
        $qsql="SELECT * from bbs_subj where id='$rid' ";
    } else {
        $qsql="SELECT * from bbs_docs where id='$rid' ";
    }
    $rs=mysql_db_query($sql['db'],$qsql);
    $row=mysql_fetch_array($rs);

    $banner=$row['banner'];
    $body=$row['body'];

    $subj=$c_poster."ざ残ゅ彻";
    $message="狟ね: $c_poster ざ残硂ゅ彻\n";
    $message.="ゅ彻夹肈:$banner\n";
    $message.="ゅ彻ず甧:$body\n";
    $message.="\nㄤ闽ゅ彻叫 http://$HTTP_HOST$PHP_SELF?proc=view&sid=$sid&aid=$aid&rid=$rid\n";
    $message.="<<舧>>\n";
    $mailfrom="From:".$c_email;

    mail($frmail,$subj,$message,$mailfrom);
    }else {
        echo "
          <script language=javascript>
              alert('E-mailΑ岿粇');
          </script>
         ";  
    }
    //echo "rid=$rid a=$aid s=$sid p=$pgno";

    echo "
          <script language=javascript>
          document.location='$PHP_SELF?proc=view&aid=$aid&sid=$sid&rid=$rid'
          </script>
         ";  
}

待续...... 

    
[2]如何在PHP中使用Oracle数据库(6)
    来源: 互联网  发布时间: 2013-11-30
利用OCI列出全部数据表'email_info'中的数据


同上,只不过用OCI来写  

相关PHP代码:


PutEnv("ORACLE_SID=ORASID");

$connection = OCILogon ("username","password");
if ($connection == false){
  echo OCIError($connection)."
";
  exit;
}

$query = "select * from email_info";
$cursor = OCIParse ($connection, $query);
if ($cursor == false){
  echo OCIError($cursor)."
";
  exit;  
}

$result = OCIExecute ($cursor);
if ($result == false){
  echo OCIError($cursor)."
";
  exit;
}

echo " ";
echo "  Full Name Email Address  
";

while (OCIFetchInto ($cursor, $values)){
  $name = $values[0];
  $email = $values[1];

  echo "  $name $email  
";
}

echo " ";

OCILogoff ($connection);

?>  


程序运行的浏览效果如下所示:

    
姓名 Email 地址  
春花 springflower@163.com  
秋月 autumnmoon@163.com  
... ...  


    
[3]如何在PHP中使用Oracle数据库(5)
    来源: 互联网  发布时间: 2013-11-30
利用ORA列出全部数据表'email_info'中的数据


下面,我们将逐条读出数据库的内容,并以html表格形式显示'email_info'数据表中的数据  

相关PHP代码:


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 = "select * from email_info";
$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;
}

echo " ";
echo "  Full Name Email Address  
";

while (Ora_Fetch_Into ($cursor, &$values)){
  $name = $values[0];
  $email = $values[1];

  echo "  $name $email  
";
}

echo " ";

Ora_Close ($cursor);
Ora_Logoff ($connection);

?>  


程序运行的浏览效果如下所示:

    
姓名 Email 地址  
春花 springflower@163.com  
秋月 autumnmoon@163.com  
... ...  


    
最新技术文章:
▪PHP函数microtime()时间戳的定义与用法
▪PHP单一入口之apache配置内容
▪PHP数组排序方法总结(收藏)
▪php数组排序方法大全(脚本学堂整理奉献)
▪php数组排序的几个函数(附实例)
▪php二维数组排序(实例)
▪php根据键值对二维数组排序的小例子
▪php验证码(附截图)
▪php数组长度的获取方法(三个实例)
▪php获取数组长度的方法举例
▪判断php数组维度(php数组长度)的方法
▪php获取图片的exif信息的示例代码
▪PHP 数组key长度对性能的影响实例分析
▪php函数指定默认值的方法示例
▪php提交表单到当前页面、提交表单后页面重定...
▪php四舍五入的三种实现方法
▪php获得数组长度(元素个数)的方法
▪php日期函数的简单示例代码
▪php数学函数的简单示例代码
▪php字符串函数的简单示例代码
▪php文件下载代码(多浏览器兼容、支持中文文...
▪php实现文件下载、支持中文文件名的示例代码...
▪php文件下载(防止中文文件名乱码)的示例代码
▪解决PHP文件下载时中文文件名乱码的问题
▪php数组去重(一维、二维数组去重)的简单示例
▪php小数点后取两位的三种实现方法
▪php Redis 队列服务的简单示例
▪PHP导出excel时数字变为科学计数的解决方法
▪PHP数组根据值获取Key的简单示例
▪php数组去重的函数代码示例
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3