Page 1 of 1

Extracting data and displaying by category

Posted: Tue Jun 05, 2007 5:22 am
by aceconcepts
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

Posted: Tue Jun 05, 2007 6:28 am
by zell11
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>

Posted: Tue Jun 05, 2007 7:27 am
by feyd
Have a read through the first two threads referenced from Useful Posts.