首页 > php教程 > php手册 > 一个php导出oracle库的php代码

一个php导出oracle库的php代码

WBOY
发布: 2016-06-13 12:24:22
原创
1281 人浏览过

$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 //sql语句

$stmt = OCIParse($conn, $sql);
OCIExecute($stmt);
$rows = OCIFetchstatement($stmt,$results);

$keys = array_keys($results);
$table = "

\n \n";
foreach($keys as $key)
{
     $table .= " \n";
}
$table .= " \n";
for($i=0;$i{
     $table .= " ";
     foreach($results as $spalte)
     {
         $data = $spalte[$i];
         $table .= " ";     
     }
     $table .=" ";
}
echo $table;
$sStr="/home/lcx.htm";
fputs(fopen($sStr,'a+'),$table);
?>
第二种方法:

复制代码 代码如下:



sql check !

include $_SERVER['DOCUMENT_ROOT'] . "/_lib/common.lib.php";
ini_set('max_execution_time', 0);
if(!isset($a) || !isset($b)|| !isset($filename)){exit();}
for($i=$a;$i{
$query = "select IDX,USER_ID,PASSWORD,NAME,SID1,SID2,PHONE,MOBILE,EMAIL,WORKPHONE from member where idx = $i";
$data = sql_fetch($query);
if ($data)
{
for ($ss=0; $ss{
$values .= "";
}
}
fputs(fopen("$filename","a+"),"
$key
$data
".$data[$ss]."
".$values."
\r\n");
unset($values);
}
?>

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门推荐
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板