putenv ("ORACLE_BASE=/ora");
                putenv ("ORACLE_HOME=/ora");
                putenv("NLS_LANG=AMERICAN");
                //$conn = Ora_PLogon("hostname","passwd");
                $conn = Ora_PLogon("web@web","web");
                @ora_commiton($conn);
$cur=ora_open($conn);
$err_no=0;
$query = "select PASSWORD from register where mobilno='$t_tele_num'"; 
 
  $result=ora_parse($cur,$query);
  $result=ora_exec($cur);
 
  if(ora_fetch($cur)) 
  $datacount = ora_getcolumn($cur, 0); 
echo "$datecount";
ora_close($cur);

解决方案 »

  1.   

    我的php文件:
    <?
    putenv ("ORACLE_BASE=/ora");
                    putenv ("ORACLE_HOME=/ora");
                    putenv("NLS_LANG=AMERICAN");
                    //$conn = Ora_PLogon("hostname","passwd");
                    $conn = Ora_PLogon("interdb","interdb");
                    @ora_commiton($conn);
    $cur=ora_open($conn);
    echo $cur."<br><br>";
    $err_no=0;
    $query = "select PASSWORD from register where mobilno='$t_tele_num'"; 
     
      $result=ora_parse($cur,$query);
      $result=ora_exec($cur);
     
      if(ora_fetch($cur)) 
      $datacount = ora_getcolumn($cur, 0); 
    echo "$datecount";
    ora_close($cur);
    ?>执行后出错:
    Warning: Unable to connect to ORACLE (ORA-12203: TNS:unable to connect to destination) in d:\japan\dnd\test1.php on line 6Warning: Supplied argument is not a valid Oracle-Connection resource in d:\japan\dnd\test1.php on line 8Warning: Supplied argument is not a valid Oracle-Cursor resource in d:\japan\dnd\test1.php on line 13Warning: Supplied argument is not a valid Oracle-Cursor resource in d:\japan\dnd\test1.php on line 14Warning: Supplied argument is not a valid Oracle-Cursor resource in d:\japan\dnd\test1.php on line 16Warning: Supplied argument is not a valid Oracle-Cursor resource in d:\japan\dnd\test1.php on line 19
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    怎么解决?/??
      

  2.   

    给你个Oracle的类,不只有用?<? ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // //    ORACLE CLASS BY ROCKTRON CHOI ([email protected]) 2000,03,27 //    Digital UNIX, Apache1.3.9, PHP3.0.7 //     //    Oracle Class have only 4 function(ExecSQL, Fetch, ColumnName, Close) //    Setting only ORACLE_UID, PRACLE_PASS //     ////////////////////////////////////////////////////////////////////////////////////////////////////////////// class Oracle {      var $ORA_CON;     var $ORA_DB;     var $CON_CHECK  = FALSE;     var $ORA_UID    = "ORACLE_UID";     var $ORA_PASS   = "ORACLE_PASS";     var $Error;     var $ErrorCode;     var $FetchCount = 0;     var $ColumCount = 0;     //////////////////////////////////////////////////////////////////////////////////////////////////////////     // DBConnect, Pase Query, Exec Query, Setting ColumCount     function ExecSQL($Query)     {         if( $this->CON_CHECK == FALSE )         {              $this->ORA_CON  = ora_logon($this->ORA_UID, $this->ORA_PASS);              $this->ORA_DB   = ora_open($this->ORA_CON);              if( Ora_ErrorCode($this->ORA_DB) != 0 )              {                  $this->Error     = Ora_Error($this->ORA_DB);                  $this->ErrorCode = Ora_ErrorCode($this->ORA_DB);                  return FALSE;              }              $this->CON_CHECK = TRUE;         }         ora_parse($this->ORA_DB, $Query);            if( ora_exec($this->ORA_DB) == FALSE )         {             $this->Error     = Ora_Error($this->ORA_DB);             $this->ErrorCode = Ora_ErrorCode($this->ORA_DB);             return FALSE;         }         $this->ColumCount = ora_numcols($this->ORA_DB);         return TRUE;     }     //////////////////////////////////////////////////////////////////////////////////////////////////////////     // Fetch Record     function Fetch()     {          $i=0;          if( !ora_fetch($this->ORA_DB) )          {              $this->Error     = Ora_Error($this->ORA_DB);              $this->ErrorCode = Ora_ErrorCode($this->ORA_DB);              return $FALSE;          }          for($i=0;$i<$this->ColumCount;$i++)          {               $FiledName1 = strtoupper(Ora_ColumnName($this->ORA_DB, $i));               $FiledName2 = strtolower(Ora_ColumnName($this->ORA_DB, $i));               $DATA       = ora_getcolumn($this->ORA_DB, $i);               $RECORD["$FiledName1"] = $DATA;               $RECORD["$FiledName2"] = $DATA;               $RECORD[$i]            = $DATA;          }          return $RECORD;     }     //////////////////////////////////////////////////////////////////////////////////////////////////////////     // return ColumnName     function ColumnName($Count)     {          return Ora_ColumnName($this->ORA_DB, $Count);     }     //////////////////////////////////////////////////////////////////////////////////////////////////////////     // Close Oracle     function Close()     {         return ora_close($this->ORA_DB);     } } /************************************************************************************************************     SAMPLE CODE     Oracle Class filename is ORACLE.INC, used by require *************************************************************************************************************     require "ORACLE.INC";     $RS  = new Oracle;     $RS2 = new Oracle;     $RS->ExecSQL("SELECT USERNAME, ZIPCODE, ADDR FROM USER WHERE USERID='$USERID'" AND PASSWD='$PASSWD');     if( ($DATA=$RS->Fetch()) == FALSE )     {          $ERROR_MSG  = $RS->Error;          $ERROR_CODE = $RS->ErrorCode;          echo(" ($ERROR_CODE:$ERROR_MSG) ");          exit;     }     $USERNAME = $DATA["USERNAME"];     $ZIPCODE  = $DATA["zipcode"];     $ADDR     = $DATA[2];     echo("          USERNAME: $USERNAME <BR>          ZIPCODE : $ZIPCODE  <BR>          ADDRESS : $ADDRESS  <BR>     ");     $RS2->ExecSQL("INSERT INTO LOGIN (USERID, LOGINTIME) VALUES ('$USERID',SYSDATE)");     $RS2->ExecSQL("COMMIT");     $RS2->Close();     $RS->Close(); *************************************************************************************************************/
      

  3.   

    我的怎么没变形〉?
     laosan(老三)兄,顺便再给我写一份引用这个类的例子。
      

  4.   

    http://sourceforge.net/projects/phplib/PHPLib 里面有最通用的 SQL 类,所有你认识的数据库上面全有,还有说明书什么的,你下了慢慢看吧http://prdownloads.sourceforge.net/phplib/phplib-7.2d.zip