Guest User

Untitled

a guest
Jul 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. $conn = new PDO($dsn);
  2. $GetAllData = $conn->prepare("SELECT a.plot_sub_usage, b.code_desc, c.code_desc, COUNT(*) as count
  3. FROM dc_plot a
  4. inner join t_setup_code b on a.plot_sub_usage = b.code_id
  5. inner join t_setup_code c on c.code_id = b.code_1
  6. GROUP BY a.plot_sub_usage, b.code_desc, c.code_desc
  7. ORDER BY a.plot_sub_usage");
  8. $GetAllData->execute();
  9. $allRecords = [];
  10. if($GetAllData->rowCount() > 0){
  11. while($AllData = $GetAllData->fetch(PDO::FETCH_ASSOC)){
  12. $allRecords[] = ($AllData);
  13.  
  14. <tbody>
  15. <?php
  16. foreach($allRecords as $v){?>
  17. <tr>
  18. <td><?php echo $v['b.code_desc'];?></td>
  19. <td><?php echo $v['c.code_desc'];?></td>
  20. <td><?php echo $v['count'];?></td>
  21. </tr>
  22. <?php }?>
  23. </tbody>
Add Comment
Please, Sign In to add comment