Everything in my code works properly but I need if someone has more than one job, do not duplicate person name just in person job field echo all jobs belong to person. This is my code:
<fieldset class="fdex" >
<legend><span class="style4">لیست مشاغل</span></legend>
<?php
$db_host = 'localhost';
$db_name = 'site';
$db_table= 'tablesite';
$db_user = 'root';
$db_pass = '';
$con = mysql_connect($db_host,$db_user,$db_pass) or die("خطا در اتصال به پايگاه داده");
$selected=mysql_select_db($db_name, $con) or die("خطا در انتخاب پايگاه داده");
mysql_query("SET CHARACTER SET utf8");
$dbresult=mysql_query("SELECT tablesite.name,
tablesite.family,
tablesite.phone_number,
tablesite.email,
job_list.job_name,
relation.comments
FROM $db_table
INNER JOIN relation
on tablesite.id_user=relation.user_id
INNER JOIN job_list
on relation.job_id=job_list.job_id",$con);
while($amch=mysql_fetch_assoc($dbresult)) {
echo "* نام: "."   ".$amch["name"]." ".
$amch["family"]."   "."* عنوان خدمت: ".
$amch["job_name"]."   "."* شماره تماس: ".
$amch["phone_number"]."   "."* ایمیل: ".
$amch["email"].'<br>'.
$amch["comments"].'<hr/>';
}
?>
</fieldset>
my code echo as this:(i do not want this way)
*name: jason irani *job:doctor *tel:same *email: same
*name: jason irani *job:software engineer *tel:same *email: same
As you see that will duplicate a record twice. I want if any one has more than one job, act as this:
*name: jason irani *job:doctor AND software engineer *tel:same *email: same
I want merge records that them email and tell is same.
How can I correct this issue?