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/15 01:42] – [students.cs.ndsu.nodak.edu] localadmin | classes:general:dbsamples:php_oracle [2017/01/15 01:44] (current) – [PHP Example Connection] localadmin | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| 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.1484444559.txt.gz · Last modified: by localadmin
