Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php include_once "mysql_connect.php" ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <?php
- $sql = "SELECT * FROM MySQLtable ORDER BY category_number";
- $result = mysqli_query($connect, $sql);
- $result_check = mysqli_num_rows($result);
- $category = null;
- $img = null;
- if ($result_check > 0)
- {
- while ($row = mysqli_fetch_assoc($result))
- {
- $item = $row["item_name"];
- $img = $row[item_img];
- if ($category != $row["item_category"])
- {
- $category = $row["item_category"];
- echo"
- <table>
- <tr>
- <th>$category</th>
- </tr>";
- }
- echo"
- <tr>
- <td>$item</td>
- <td><img src='item_image_folder/img'></td>
- </tr>";
- }
- echo"</table>";
- }
- ?>
- </body>
- </html>
- Category 1
- item_name image
- item_name image
- Category 2
- item image
- item image
- Category 3
- long_item_name image
Add Comment
Please, Sign In to add comment