khirulnizam

listing.php with Bootstrap template

Jan 30th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. <?php
  2. //include the database connectivity setting
  3. include ("inc/dbconn.php");
  4. //include the navigation bar
  5. include ("inc/header-navbar.php");?>
  6.  
  7. <div class="container">
  8. <br>
  9. <br>
  10. <div class="row">
  11. <div class="col-md-9" name="maincontent" id="maincontent">
  12. <!-- ***********Edit your content STARTS from here******** -->
  13. <h5>Template for PHP-MySQL Exercises</h5>
  14. Employee Listing<br>
  15.  
  16. <?php
  17. //sql code to capture name & id
  18. $sql="select EMPNO, FIRSTNAME, LASTNAME
  19. from employee";
  20. $qr=mysqli_query($db,$sql);
  21. if(mysqli_num_rows($qr)==0){//record not found
  22. echo "Record not found";
  23. }
  24. else{//record listing
  25. echo "<table class='table table-striped table-bordered'>
  26. <thead>
  27. <tr>
  28. <th>EMPNO</th>
  29. <th>FULLNAME</th>
  30. </tr>
  31. </thead>";
  32. echo "<tbody>";
  33. while($rec=mysqli_fetch_array($qr)){
  34.  
  35. echo "<tr>";
  36. echo
  37. "<td>".$rec['EMPNO'].
  38. "</td>
  39. <td>".
  40. $rec['FIRSTNAME']." ".
  41. $rec['LASTNAME'].
  42. "</td>";
  43. echo "</tr>";
  44. }
  45. echo "</tbody>
  46. </table>";
  47. }
  48. ?>
  49.  
  50. <!-- ***********Edit your content ENDS here******** -->
  51.  
  52. </div><!-- end main content -->
  53.  
  54.  
  55. <?php
  56. //include the sidebar menu
  57. include ("inc/sidebar-menu.php");
  58. ?>
  59. </div><!-- end row -->
  60.  
  61. </div><!-- end container -->
  62.  
  63.  
  64. <?php
  65. //include the footer
  66. include ("inc/footer.php");?>
Advertisement
Add Comment
Please, Sign In to add comment