I am trying to show all Items (TicketNo) of a group (GroupNo) including ItemCount. The Problem is: it shows only the first Item. This is my code:
<?php
foreach($dbh->query('SELECT GroupNo,COUNT(*),Tickets.*
FROM Tickets
WHERE entryScans != 0
GROUP BY GroupNo') as $row) {
echo "<tr><th>" . $row['GroupNo'] . "</th><th>" . $row['COUNT(*)'] . "</th></tr>";
echo "<tr><th>" . $row['TicketNo'] . "</th><th>" . $row['hash'] . "</th></tr>";
}
?>
EDIT: this is the result i want:
Gourp 1 (Count:3)
- Ticket 1
- Ticket 2
- Ticket 3
Group 2 (Count:2)
- Ticket 4
- Ticket 5
Group 3 (Count:4)
- Ticket 6
- Ticket 7
- Ticket 8
- Ticket 9
But what i get right now is:
Gourp 1 (Count:3)
- Ticket 1
Group 2 (Count:2)
- Ticket 4
Group 3 (Count:4)
- Ticket 6