私持っている二つのテーブル1項目テーブルと顧客テーブル:テーブル内の 動的な行スパンのphp whileループ
あなたは1002年の2つ持っている2番目の項目の項目IDを参照することができentries.and私はそれにはcolspanを追加しますアイテム欄1と3
<table>
<tr>
<th>Item ID</th>
<th>Item Color</th>
<th>Customer</th>
</tr>
<?php
$sql = mysqi_query($con,"select * from item_table");
while($row = mysqli_fetch_array($sql)){
?>
<tr>
<td><?=$row['item_id'];?></td>
<td><?=$row['item_color'];?></td>
<td>
<select>
<?php
$sql_cust = mysqli_query($con,"select * from customer_tbl");
while($row_cust = mysqli_fetch_array()){
if($row['customer_id'] == $row_cust['customer_id']){
echo "<option selected='selected' >".$row['customer_name']."</option>";
}else{
echo "<option>".$row['customer_name']."</option>";
}
<?php
}
?>
</select>
</td>
</tr>
<?php
}
?>
</table>
のためしかし、それは通常の方法で印刷し、私はloop..pleaseにROWSPANを追加する方法を見当がつかないその感謝を解決するためにいくつかのロジックを示唆しています。