Ok, I have a column named "Company" and I have multiple rows within this column.
Now, I want to have the column name output to the browser once and then have all of the records related to the "Company" also output.
E.G
ACME Company
Rec1
Rec2
Rec3
BlahBlah Company
Rec1
Rec2
Rec3
When I make my query without the 'Group By' I get:
ACME Company
Rec1
ACME Company
Rec2
.....
When I make the query WITH the 'Group By' I only get one record to display under each company (the first record within that group).
Current query:
$uploads_qry = "select *
from project_mgr_permissions, uploads, clients
where project_mgr_permissions.username = '{$_SESSION['auth_user']}'
and uploads.client = clients.code
and clients.code = project_mgr_permissions.company
group by clients.company";
}
My display output:
while ($uploads = $uploads_result->fetch_assoc())
{
echo "<tr><td><h4>";
echo $uploads['company'];
echo '</h4></td><td>';
echo "<a href=admin/download.php?id={$uploads['id']}>
{$uploads['title']}<br />
</a>";
echo '</td><td>';
Can anyone point me in the right direction??