Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. <?php
  2. include_once __DIR__.'/header2.php';
  3. if(!isset($_SESSION['u_uid'])) {
  4. header("Location: index.php?=mustloginfirst");
  5. exit();
  6. } else {
  7. include_once __DIR__.'/includes/dbh.php';
  8.  
  9. $sql = "SELECT * FROM primervideos;";
  10.  
  11. $stmt = mysqli_stmt_init($conn);
  12. if (!mysqli_stmt_prepare($stmt, $sql)) {
  13. echo "SQL error";
  14.  
  15. } else {
  16.  
  17. mysqli_stmt_execute($stmt);
  18. $result = mysqli_stmt_get_result($stmt);
  19. $resultCheck = mysqli_num_rows($result);
  20. echo '<table class="primervideos">
  21.  
  22. <tr>
  23. <th colspan="2" class="update_title">Welcome to the Primer Videos' Section</th>
  24. </tr>';
  25. $rowCounter = 0;
  26. while($row = mysqli_fetch_assoc($result)) {
  27. $rowCounter++;
  28. if ($resultCheck < 1) {
  29. header("Location: header2.php?primervideos=nolessons");
  30. exit();
  31. } else {
  32.  
  33. echo '<tr>
  34. <th>Result No:</th><td>',htmlspecialchars($rowCounter),'</td>
  35. </tr>
  36. <tr>
  37. <th>Lesson '.$rowCounter.':</th><td><a href="#">',htmlspecialchars($row['lessons']),'</a></td>
  38. </tr>
  39. <tr>
  40. <th>Date Submitted:</th><td>',htmlspecialchars($row['date_submitted']),'</td>
  41. </tr>';
  42.  
  43. }
  44.  
  45. }
  46. echo '</table>';
  47. }
  48. }
  49.  
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement