I'm trying to make 3 tables, I've used this while loop, the problem that I didn't know how to make the loop insert the new row in the same table. It makes new tables for each new row or just mess it up by putting information that should appear in another table.
Please help me.
What I got:
contract name cost period 210 sama 20 3 id date account visit 2 3-jun 20 3 ... contract name cost period 200 mama 10 3 id date account visit 4 10 3 2 .... contract name cost period 210 ana 50 6 id date account visit 6 50 6 5
What I want:
contract name cost period 210 sama 20 3 200 mama 10 3 210 ana 50 6 id date account visit 2 3-jun 20 3 4 10 3 2 6 50 6 5
This is my code:
<?php while($row = mysqli_fetch_array($search_result)):?>
<div style="font-size:1.5rem; padding:0px; margin:0px; position:relative; width:95%; " dir="rtl">
<h1>contract </h1>
<table bgcolor="#fff" align="center" width="70%" border="3" dir="rtl" style="font-size:1.5rem; ">
<tr>
<td>name</td>
<td>cost</td>
<td>period</td>
<tr>
<td><?php echo $row['contract_num'];?></td>
<td><?php echo $row['cost'];?></td>
<td><?php echo $row['bla'];?></td>
<td><?php echo $row['serv'];?></td>
</tr>
</table></div>
<div style="font-size:1.5rem; padding:0px; margin:0px; position:relative; width:95%; " dir="rtl">
<h1>visits</h1>
<table bgcolor="#fff" align="center" width="70%" border="3" dir="rtl" style="font-size:1.5rem; ">
<tr>
<td>id</td>
<td>date</td>
<td>account</td>
<td>visit</td>
<tr>
<td><?php echo $row['id'];?></td>
<td><?php echo $row['date'];?></td>
<td><?php echo $row['account'];?></td>
<td><?php echo $row['visit'];?></td>
</tr>
</table></div>
<?php endwhile;?>