daily pastebin goal
40%
SHARE
TWEET

Untitled

avolle Feb 22nd, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. include "connect.php"; //Another php file that simply establishes a database connection
  4. include "header.php";
  5. //It appears as if footer.php is loaded here.
  6.  
  7. $SQL = "SELECT
  8.            `cat_id`,
  9.            `cat_name`,
  10.            `cat_description`
  11.        FROM
  12.            `categories`";
  13.  
  14. $result = mysqli_query($conn, $SQL);
  15.  
  16. if(!$result): ?>
  17.     The categories could not be displayed. Please try again later.
  18. <?php else:
  19.     if(mysqli_num_rows($result) == 0): ?>
  20.         No categories defined yet.
  21.     <?php else: ?>
  22.         <table class='row' border='1'>";
  23.             <tr>
  24.                 <th>Category</th>
  25.                 <th>Last topic</th>
  26.             </tr>
  27.  
  28.             <?php while($row = mysqli_fetch_assoc($result)): ?>
  29.                 <tr>
  30.                     <td class='leftPart'>
  31.                         <h3 class='catName'><a href='category.php?id=<?= $row["cat_id"];?>'><?= $row["cat_name"];?></a></h3>
  32.                         <p class='catDescription'><?= $row["cat_description"];?></p>
  33.                     </td>
  34.                     <td class='rightPart'>
  35.                         <p class='lastTopic'><a href='topic.php?id='>WIP</a></p>
  36.                     </td>
  37.                 </tr>
  38.             <?php endwhile; ?>
  39.         </table>
  40.     <?php endif;
  41. endif;
  42.  
  43. include "footer.php";
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top