Guest User

Untitled

a guest
Jun 17th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <?php include_once "mysql_connect.php" ?>
  2.  
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <title></title>
  7. </head>
  8. <body>
  9.  
  10. <?php
  11. $sql = "SELECT * FROM MySQLtable ORDER BY category_number";
  12. $result = mysqli_query($connect, $sql);
  13. $result_check = mysqli_num_rows($result);
  14.  
  15. $category = null;
  16. $img = null;
  17.  
  18. if ($result_check > 0)
  19. {
  20. while ($row = mysqli_fetch_assoc($result))
  21. {
  22. $item = $row["item_name"];
  23. $img = $row[item_img];
  24.  
  25. if ($category != $row["item_category"])
  26. {
  27. $category = $row["item_category"];
  28. echo"
  29. <table>
  30. <tr>
  31. <th>$category</th>
  32. </tr>";
  33. }
  34. echo"
  35. <tr>
  36. <td>$item</td>
  37. <td><img src='item_image_folder/img'></td>
  38. </tr>";
  39. }
  40. echo"</table>";
  41. }
  42. ?>
  43. </body>
  44. </html>
  45.  
  46. Category 1
  47.  
  48. item_name image
  49. item_name image
  50.  
  51. Category 2
  52.  
  53. item image
  54. item image
  55.  
  56. Category 3
  57.  
  58. long_item_name image
Add Comment
Please, Sign In to add comment