Skip to content

Instantly share code, notes, and snippets.

@jvandijk
Created August 19, 2011 15:29
Show Gist options
  • Save jvandijk/1157077 to your computer and use it in GitHub Desktop.
Save jvandijk/1157077 to your computer and use it in GitHub Desktop.
Oracle Instant Client - Zend Server connectivity
<?php
$conn = oci_connect('username', 'password', 'xxx.xxx.xxx.xxx:1521/instancename');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// connect to the dual table for testing purposes
$stid = oci_parse($conn, 'SELECT * FROM dual');
oci_execute($stid);
echo "<table border='1'>\n";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
echo "<tr>\n";
foreach ($row as $item) {
echo " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : "&nbsp;") . "</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment