php导出oracle库

php导出oracle库

代码如下:

<?php

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

//$sql="select*fromall_tab_columnswheretable_name='MEMBER'";//TableStructure

$sql="selectUSER_ID,PASSWORDfromMEMBERwhereIDX<100";//sql语句

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

OCIExecute($stmt);

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

$keys=array_keys($results);

$table="<table>\n<TR>\n";

foreach($keysas$key)

{

$table.="<TH>$key</TH>\n";

}

$table.="</TR>\n";

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

{

$table.="<TR>";

foreach($resultsas$spalte)

{

$data=$spalte[$i];

$table.="<TD>$data</TD>";

}

$table.="</TR>";

}

echo$table;

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

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

?>