php查询Oracle 数据
时间:2010-12-07 来源:nothing9
http://blog.chinaunix.net/u/28922/showart_2190451.html
<?php
$db_server = "localhost";
$db_user = "TPARK";
$db_pass = "123456";
$db_sid = "atyu30";
$dbconn=oci_connect($db_user,$db_pass,"(DEscriptION=(ADDRESS=(PROTOCOL =TCP)(HOST=127.0.0.1)(PORT = 1521))(CONNECT_DATA =(SID=$db_sid)))");
?>
<?php
include_once("config.php");
/*
if($dbconn!=false)
{
echo "连接";
echo "DB服务器:".$db_server;
echo "用户:".$db_user;
echo "口令:".$db_pass;
echo "SID:".$db_sid;
echo "成功\n";
if(OCILogOff($dbconn)==true)
{
echo "关闭连接成功!";//=这里有问题
}
}
else
{
echo "连接失败";
}
*/
$sql = "select * from editor";
$oci_rs = oci_parse($dbconn,$sql);
oci_execute($oci_rs,OCI_DEFAULT);
while($row=oci_fetch_array($oci_rs,OCI_ASSOC)) {
print_r($row);
}
?>
<?php
$db_server = "localhost";
$db_user = "TPARK";
$db_pass = "123456";
$db_sid = "atyu30";
$dbconn=oci_connect($db_user,$db_pass,"(DEscriptION=(ADDRESS=(PROTOCOL =TCP)(HOST=127.0.0.1)(PORT = 1521))(CONNECT_DATA =(SID=$db_sid)))");
?>
<?php
include_once("config.php");
/*
if($dbconn!=false)
{
echo "连接";
echo "DB服务器:".$db_server;
echo "用户:".$db_user;
echo "口令:".$db_pass;
echo "SID:".$db_sid;
echo "成功\n";
if(OCILogOff($dbconn)==true)
{
echo "关闭连接成功!";//=这里有问题
}
}
else
{
echo "连接失败";
}
*/
$sql = "select * from editor";
$oci_rs = oci_parse($dbconn,$sql);
oci_execute($oci_rs,OCI_DEFAULT);
while($row=oci_fetch_array($oci_rs,OCI_ASSOC)) {
print_r($row);
}
?>
相关阅读 更多 +