Created
August 19, 2011 15:29
-
-
Save jvandijk/1157077 to your computer and use it in GitHub Desktop.
Oracle Instant Client - Zend Server connectivity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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) : " ") . "</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