You need to add a sort to your query so that results fall into categories:
$query = "SELECT *
FROM client, job, category
WHERE client.client_id = $client_id
AND client.client_id = job.client_id
AND client.job_id = job.job_id
AND client.category_id = category.category_id
ORDER BY category, client, job";
From there, I'd just add a check to see if the previous category equals the current category:
$old_category = "nothing";
while($row = mysql_fetch_assoc($result))
{
// Echo category heading only if it is new...
if($row['category'] != $old_category) echo "<strong>$category</strong><br>";
// Echo job details...
echo " ".$row['job']."<br>";
// Make this category the old_category...
$old_category = $row['category'];
}
You can use this same method for client headings, if necessary.