PHP查询不适用于Oracle数据库

I have a php page that is connecting to an oracle database. I am trying to print out the records from a table TEAM.

// Remember to replace 'username' and 'password'!
$conn = oci_connect('username','password','(DESCRIPTION=(ADDRESS_LIST= 
(ADDRESS=(PROTOCOL=TCP)(Host=db2.ndsu.edu)(Port=1521)))(CONNECT_DATA= 
(SID=cs)))');
echo $conn;
//put your query here
$query = "SELECT * FROM TEAM";
$stid = oci_parse($conn,$query);
oci_execute($stid,OCI_DEFAULT);

//iterate through each row
while ($row = oci_fetch_array($stid,OCI_ASSOC)) 
{
//iterate through each item in the row and echo it  
foreach ($row as $item)    
{
    echo $item.' ';
}   
echo '<br/>';}
oci_free_statement($stid);
oci_close($conn);
?>

I did change the user name and password. The echo $conn is printing out "Resource id #4" so I believe I am connected to the database.

douwu5009
douwu5009 请更新您的问题以了解更多详细信息,例如错误。我建议(i)添加一些错误检查和阅读oracle.com/technetwork/topics/php/...
接近 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问