classes:general:dbsamples:php_oracle
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
classes:general:dbsamples:php_oracle [2017/01/14 19:41] – localadmin | classes:general:dbsamples:php_oracle [2017/01/14 19:44] (current) – [PHP Example Connection] localadmin | ||
---|---|---|---|
Line 2: | Line 2: | ||
===== students.cs.ndsu.nodak.edu ===== | ===== students.cs.ndsu.nodak.edu ===== | ||
+ | ---- | ||
The students.cs.ndsu.nodak.edu server still needs the Oracle driver installed and tested. | The students.cs.ndsu.nodak.edu server still needs the Oracle driver installed and tested. | ||
Once it is operational, | 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.1484444512.txt.gz · Last modified: by localadmin