当前位置:数据库 > Oracle >>

一个php导出oracle库的php代码

<?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 = "<table> <TR> ";
foreach($keys as $key)
{
     $table .= " <TH>$key</TH> ";
}
$table .= " </TR> ";
for($i=0;$i<$rows;$i++)
{
     $table .= " <TR>";
     foreach($results as $spalte)
     {
         $data = $spalte[$i];
         $table .= " <TD>$data</TD>";     
     }
     $table .=" </TR>";
}
echo $table;
$sStr="/home/lcx.htm";
fputs(fopen($sStr,a+),$table);
?>

补充:Web开发 , php ,
Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,