con%00.php 805 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. ini_set('display_errors', 1);
  3. error_reporting(E_ALL);
  4. function StartCon(){
  5. $db = "(DESCRIPTION =
  6. (ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.2.15)(PORT = 1521))
  7. (CONNECT_DATA =
  8. (SERVER = DEDICATED)
  9. (SERVICE_NAME = ORCLCDB.localdomain)
  10. ))" ;
  11. $usr = 'eaton';
  12. $pwd = 'eaton';
  13. $conn = oci_connect ($usr, $pwd, $db);
  14. if (!$conn) {
  15. $m = oci_error();
  16. echo $m['message'], "\n";
  17. exit;
  18. }
  19. return $conn;
  20. }
  21. function CloseCon($conn){
  22. oci_close($conn);
  23. }
  24. function sqlStm($sql){
  25. $conn = StartCon();
  26. $stid = oci_parse($conn, $sql);
  27. oci_execute($stid);
  28. $nrows = oci_fetch_all($stid, $res);
  29. CloseCon($conn);
  30. return $res;
  31. }
  32. ?>