php导出oracle库的php代码 -电脑资料

电脑资料 时间:2019-01-01 我要投稿
【www.unjs.com - 电脑资料】

   

   

    php导出oracle库的php代码

   

    $conn=OCILogon("用户名","密码","(DESCRIPTION=(ADDRESS=(PROTOCOL =TCP)(HOST=IP)(PORT = 1521))(CONNECT_DATA =(SID=lcx)))");

    //$sql="select * from all_tab_columns where table_name='MEMBER'";//Table Structure

    $sql="select USER_ID,PASSWORD from MEMBER where IDX < 100"; //sql语句

    $stmt = OCIParse($conn, $sql);

    OCIExecute($stmt);

    $rows = OCIFetchstatement($stmt,$results);

    $keys = array_keys($results);

    $table = "\n \n";

    foreach($keys as $key)

    {

    $table .= " $key\n";

    }

    $table .= " \n";

    for($i=0;$i<$rows;$i++)

    {

    $table .= " ";

    foreach($results as $spalte)

    {

    $data = $spalte[$i];

    $table .= " $data";

    }

    $table .=" ";

    }

    echo $table;

    $sStr="/home/lcx.htm";

    fputs(fopen($sStr,'a+'),$table);

    ?>

最新文章