说明:Data1表中有数据,用sqlplus可以查,但下面这个php页就是不显示数据,用var_dump($array)就可以,但我不要列表方式的小弟刚接触php,求高手帮忙!!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>test </title></head><?php//include("conn.php");
function php_conn_ora(){$username='test;$passwd='test';$protocol='TCP';$SERVICE_NAME='orcl';$ORACLE_SERVER_IP_ADDRESS='*.*.*.*';$Port='1521';PutEnv("NLS_LANG=SIMPLIFIED CHINESE_CHINA.AL32UTF8");if(!$conn = oci_connect($username, $passwd, "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = $protocol)(HOST = $ORACLE_SERVER_IP_ADDRESS)(PORT = $Port)) ) (CONNECT_DATA = (SERVICE_NAME = $SERVICE_NAME) ) )")) echo("Error in Connecting to DataBase");return $conn;}
$conn=php_conn_ora();
$query ="SELECT * FROM TEST.DATA1";
$stid = oci_parse($conn,$query);
if (!$stid) {
  $e = oci_error($conn);
  print htmlentities($e['message']);
  exit;
}else
{
echo '@@';
}$r = oci_execute($stid,OCI_DEFAULT);//echo $r;if(!$r) {
  $e = oci_error($stid);
  echo htmlentities($e['message']);
  exit;
}else
{
echo '##';
}/*
print ' <table border="1">';while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS+OCI_ASSOC)) {
  print ' <tr>';
  foreach ($row as $item) {
      print ' <td>'.($item?htmlentities($item):' ').' </td>';
  }
  print ' </tr>';
}
print ' </table>';
*/
/*
if($row= oci_fetch_array($stid,OCI_RETURN_NULLS+OCI_ASSOC)) {echo $row[1]."&&&&&&&&&&";}
else
{
echo $row[1]."!!!!!!!!!";
}
*/
print oci_fetch_array($stid, OCI_RETURN_NULLS+OCI_ASSOC);
print "ok";// Fetch the results in an associative array
print ' <table border="1"> <tr> <td>ddd </td> </tr>';
while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS+OCI_ASSOC)) {
  print ' <tr>';
  foreach ($row as $item) {
      print ' <td>'.($item?htmlentities($item):' ').' </td>';
  }
  print ' </tr>';
}
print ' </table>';
// Close the Oracle connection
oci_close($conn); 
/*
oci_fetch_all($stid,$array);
echo " <pre>";
var_dump($array);
echo " </pre>";
*/
?>