我一直用提OCI那些连接oracle的函数
OCILogon($dbusername,$dbpassword,$ora8_sid)
$statemnet=OCILParse($sql);
OCIExecute($sql);
OCIResult()
OCIResultInot()等,
你下载一个英文的PHP手册里边所有函数都有还有例子!

解决方案 »

  1.   

    第三行的是OCIParse($sql)
    下面是插入数据的例子:
    <?php
    include("../global/dbconfig.inc.php");
    $conn=OCILogon($dbusername,$dbpassword,$ora8_sid);
    if (!$conn)

    echo "<h1>ERROR - Could not connect to Oracle</h1>"; 
    exit; 

    $sql="insert into user_reg_info (phone_num,phone_manu,phone_type,user_password)values(".$phonenum."',".$phonemanu.",".$phonetype.",'".$Password."')";
    $statement=OCIParse($conn,$sql);
    if(!$statement)
    {
    echo "<h1>ERROR - Could not parse SQL   statement.</h1>"; 
    exit; 

    OCIExecute($statement);
    OCICommit($conn);
    OCIFreeStatement($statement); 
    OCILogoff($conn);
    ?>
    下面是有结果返回的例子:
    <?php
         <?php
    include("../global/dbconfig.inc.php");
    $conn=OCILogon($dbusername,$dbpassword,$ora8_sid);
    if (!$conn)

    echo "<h1>ERROR - Could not connect to Oracle</h1>"; 
    exit; 

             $sql="select ……";//你的select 语句
             
    $stmt=OCIParse($conn,$sql); 
    if(!$stmt) 

    echo "<h1>ERROR - Could not parse SQL statement.</h1>";  
    exit; 

    $result=OCIExecute($stmt); 
    $ncols = OCINumCols($stmt);
    /*for($i=1;$i<=$ncols,$i++)
    {
    $column_names[$i]=OCIColumnName($stmt,$i);
    }*/
    if(!$result) 

    echo "<h1>ERROR - Could not execute SQL.</h1>"; 
    OCIFreeStatement($stmt);
    exit;
    }else 

    $row=0; 
    while(OCIFetch($stmt)) 
    {  
    for($cols=1;$cols<=$ncols;$cols++)
    {
    $Result[$row][$cols]=OCIResult($stmt,$cols); //这一行取ID 


    $row++;
    }  
    }       
    ?>