classes:general:dbsamples:php_oracle
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| classes:general:dbsamples:php_oracle [2017/01/15 01:41] – created localadmin | classes:general:dbsamples:php_oracle [2017/01/15 01:44] (current) – [PHP Example Connection] localadmin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Using the Oracle driver in PHP ====== | ====== Using the Oracle driver in PHP ====== | ||
| + | |||
| + | ===== students.cs.ndsu.nodak.edu ===== | ||
| + | ---- | ||
| + | The students.cs.ndsu.nodak.edu server still needs the Oracle driver installed and tested. | ||
| + | |||
| + | Once it is operational, | ||
| + | |||
| + | ==== PHP Example Connection ==== | ||
| + | |||
| + | Here is a small example to connect to the Oracle database from PHP, be sure to replace ' | ||
| + | |||
| + | < | ||
| + | <?php | ||
| + | |||
| + | // The connection string is loooooooong. It's easiest to copy/paste this line. Remember to replace ' | ||
| + | $conn = oci_connect(' | ||
| + | |||
| + | // Put your query in here | ||
| + | $query = ''; | ||
| + | |||
| + | $stid = oci_parse($conn, | ||
| + | oci_execute($stid, | ||
| + | |||
| + | // Iterate through each row | ||
| + | while ($row = oci_fetch_array($stid, | ||
| + | { | ||
| + | // Iterate through each item in the row and echo it | ||
| + | | ||
| + | { | ||
| + | echo $item.' | ||
| + | } | ||
| + | echo '< | ||
| + | } | ||
| + | oci_free_statement($stid); | ||
| + | oci_close($conn); | ||
| + | |||
| + | ?> | ||
| + | |||
| + | </ | ||
classes/general/dbsamples/php_oracle.1484444479.txt.gz · Last modified: by localadmin
