Advertisement
Guest User

Untitled

a guest
Mar 12th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>PHP Test</title>
  4. </head>
  5. <body>
  6. <?php
  7. echo "OCI Test<br>";
  8. $tns = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=abc.xyz.us-west-2.rds.amazonaws.com)(PORT=1521))(SOURCE_ROUTE = yes)(CONNECT_DATA=(SERVICE_NAME=orcl)))";
  9. echo "<pre>$tns</pre>n";
  10. $username = "xxx";
  11. $password = "yyy";
  12. $db = @oci_connect($username, $password, $tns);
  13. // Gets to here before stopping
  14. if (!$db)
  15. {
  16. $e = oci_error();
  17. print_r(oci_error());
  18. trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
  19. }
  20.  
  21. $sql = "SELECT * FROM manufacturer";
  22. $stmt = oci_parse($db, $sql);
  23. if(OCIExecute($stmt))
  24. {
  25. while(OCIFetchInto($stmt, $row, OCI_RETURN_NULLS))
  26. {
  27. echo $row[0]. "-" . $row[1]."<br>";
  28. }
  29. }
  30. oci_free_statement($stmt);
  31.  
  32. ?>
  33. </body>
  34. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement