Guest User

Untitled

a guest
Apr 22nd, 2019
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. <?php
  2. if (isset($_POST['dno'])) {
  3. $db_sid = "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) ) (CONNECT_DATA = (SID = orcl) ) )";
  4. $db_user = "scott";
  5. $db_pass = "tiger";
  6.  
  7. $c = oci_connect($db_user, $db_pass, $db_sid);
  8. if (!$c) {
  9. die("Connection Failed");
  10. }
  11.  
  12.  
  13.  
  14. $q = "SELECT * FROM emp WHERE dno = '". $_POST['dno'] ."'";
  15. $p = oci_parse($c, $q);
  16. $r = oci_execute($p);
  17. }
  18. ?>
  19.  
  20. <!DOCTYPE html>
  21. <html lang="en">
  22. <head>
  23. <title>SEARCH</title>
  24. </head>
  25. <body>
  26. <form action="search.php" method="POST">
  27. <label>Department No.</label>
  28. <input type="text" id="dno" name="dno">
  29. <input type="submit" value="Search">
  30. </form>
  31. <?php
  32. if (isset($_POST['dno'])) {
  33. ?>
  34. <table align="center">
  35. <thead>
  36. <tr>
  37. <th>Emp No</th>
  38. <th>Emp Name</th>
  39. <th>Job</th>
  40. </tr>
  41. </thead>
  42. <tbody>
  43. <?php
  44. while ($s = oci_fetch_array($p, OCI_BOTH + OCI_RETURN_NULLS)) {
  45. ?>
  46.  
  47. <tr>
  48. <td><?= $s['EMPNO']; ?></td>
  49. <td><?= $s['ENAME']; ?></td>
  50. <td><?= $s['JOB']; ?></td>
  51. </tr>
  52.  
  53. <?php
  54. } ?>
  55. </tbody>
  56. </table>
  57. <?php
  58. }
  59. ?>
  60.  
  61.  
  62. </body>
  63. </html>
Add Comment
Please, Sign In to add comment