Hi,
I have a database that has the following structure:
tblClient: clientId, clientName, dob
tblSite: siteId, siteName
tblAttendees: siteId, clientId
tblEvent: eventId, siteId
My question is: what is the best way to display data from the above tables to like like this:
Site: Chicago | No. of attendees: 5
Client name DOB
Mr Smith 25/04/50
Mr Brown 12/12/25
Site: Shanghai | No. of attendees: 2
Client name DOB
Mr Orange 25/04/50
Mr Pink 12/12/25
Just to clarify the above, i'd like to display each site and then display all the related fields as sub lists of the parent site.
Hope this is clear.
Thanks.
Nick
Extracting data and displaying by category
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
best way to do this would be to use tables
Code: Select all
// SQL ETC HERE
<table>
<tr>
<td> Client Name </td>
<td> DOB </td>
</tr>
<?php
while($data = mysql_fecthobject($results))
{
?>
<tr>
<td><?=$data->clientName ?></td> <- if using mysql_fecthobject() otherwise change the php between <td></td>
<td><?=$data->dob ?> </td>
</tr>
<?php
}
?>
</table>