I am making the code of PHP-MySQL. But I gain have the 2 and more as the result of the left join in the MySQL. So I want to union the results in a cell of the result table as the captured picture.
Here is my real captured picture in my computer.
My php code is as like below.
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_array($result))
{
echo "<table border='1' style='background:#dddddd;border-color:green;'>";
echo "<h2><p >진료과 (Subject) : ".$row['subject']."</p></h2>";
echo "<tr>";
echo "<th >"."<form action='search1.php' method='get'>"."<button type='submit'
name='code' value='".$row['code']."'>Code</th>";
echo "<th ><a href='".$row['ds_url']."'>"."한국병명</a></th>";
echo "<th ><a href='".$row['ds_url']."'>"."Disease name(En.)</a></th>";
echo "<th >"."<form action='search1.php' method='get'>"."<button type='submit'
name='code' value='".$row['family']."'>"." Family History</button> </th>";
echo "</tr>";
echo "<tr>";
echo "<td >" . $row['code'] . "</td>";
echo "<td >" .$row['disease_co']."</td>";
echo "<td >" .$row['disease_en']."</td>";
echo "<td >" .$row['family']."</td>";
echo "</tr>";
---
echo "<tr>";
echo "<th>소아과</th>";
echo "<th>내과</th>";
echo "<th>산과</th>";
echo "<th>정형외과</th>";
echo "</tr>";
echo "<tr>";
echo "<td>".$row['ped_content']."</td>";
echo "<td>".$row['im_content']."</td>";
echo "<td>".$row['ob_content']."</td>";
echo "<td>".$row['os_content']."</td>";
echo "</tr>";
----
echo "</table>";
}
The While phrase in the above php code is just 1, but the number of the result table depend on the number of im_content.
So, I want to union the result of im_content in a cell as the above captured picture. But, I am short of ability. Please give me a piece of advice. Thank you for your concern.
My sql query sentence is as like below.
SELECT code_en.code, code_co.disease_co, code_en.disease_en , hx.family,
hx.personal, note.note, inclusion.inclusion, exclusion.exclusion, ds.ds_content,
------
subject.icd_category, subject.group_code, im.im_content
FROM code_en
LEFT JOIN subject ON code_en.code = subject.code
LEFT JOIN note ON code_en.code = note.code
-------
left join im on code_en.code = im.code
WHERE code_en.code = '".$code."'"
Thank you, Barmar!