0
我在从远程服务器上的Oracle 10g数据库检索数据时遇到问题。我在Linux Debian网络服务器上使用PHP,并且oci8已启用并正在运行。我只是得到一个空白页面。代码如下:使用PHP从Oracle数据库检索数据
<?php
$conn = oci_connect('username','password','//server IP address:1521/servicename');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// Prepare the statement
$stid = oci_parse($conn, 'SELECT * FROM table');
if (!$stid) {
$e = oci_error($conn);
//trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// Perform the logic of the query
$r = oci_execute($stid);
if (!$r) {
$e = oci_error($stid);
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// Fetch the results of the query
print "<table border='1'>\n";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
print "<tr>\n";
foreach ($row as $item) {
print " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . "</td>\n";
}
print "</tr>\n";
}
print "</table>\n";
oci_free_statement($stid);
oci_close($conn);
?>
我不知道如何清楚地定义我想连接的数据库,因为服务器上有多个Oracle数据库。
任何帮助将不胜感激。
是否打开了错误报告?你会得到任何错误消息,可以帮助你调试吗? – Maximus2012
我只是得到一个空白页面,所以会打开错误报告 – Marcus