Advertisement
Rostyslav_Ivanyk

CategoriesList.php

Aug 30th, 2014
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.80 KB | None | 0 0
  1. <?php
  2.  
  3. require_once('DbManager.php');
  4. require_once('categories.php');
  5.  
  6. dbConnect();
  7.  
  8. $categoriesList = getCategories();
  9.  
  10. ?>
  11.  
  12. <!DOCTYPE html>
  13. <html>
  14. <head>
  15. <title>Categories</title>    
  16. </head>
  17. <body>
  18.  
  19.  
  20. <table border=1px>
  21.     <tr>
  22.         <th>Id</th>
  23.         <th>Category</th>
  24.         <th>Amount of products</th>
  25.     </tr>
  26.  
  27. <?php
  28. foreach ($categoriesList as $item) {
  29.        
  30.     $id = $item['category_id'];
  31.     $category = $item['name'];
  32.     $count = $item['count'];
  33.    
  34.    
  35.     print '<tr>';
  36.     print '<td>' . $id . '</td>';
  37.     print '<td>' . $category . '</td>';
  38.     print '<td><a href="list.php?id=' . $id . '">' . $count . '</a></td>';
  39. }
  40.  
  41. ?>
  42. </table>
  43. <br>    
  44. <a href="list.php?id=0">All products</a> | <a href="CategoriesList.php">Categories</a>
  45.  
  46.    
  47. </body>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement