Guest User

Untitled

a guest
Sep 25th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. <?php
  2.  
  3. // connect ke oracle xe pakai easy naming
  4. $conn = oci_connect('hr', 'hr', '//localhost/xe');
  5. if (!$conn) {
  6. $e = oci_error();
  7. trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
  8. }
  9.  
  10. // execute query
  11. $stid = oci_parse($conn, 'select * from employees');
  12. oci_execute($stid);
  13.  
  14. // tampilkan data
  15. echo "<table border='1'>\n";
  16. while ($row = oci_fetch_assoc($stid)) {
  17. echo "<tr>\n";
  18. foreach ($row as $item) {
  19. echo " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : "&nbsp;") . "</td>\n";
  20. }
  21. echo "</tr>\n";
  22. }
  23. echo "</table>\n";
  24.  
  25. ?>
Add Comment
Please, Sign In to add comment