如何在 html table 中显示 php 中多列的逗号分隔值

how to display comma separated values from multiple columns in php inside html table

我有一个 sql table 三列有逗号分隔的值,我试图在 html table 中打印它,我的代码看起来像以下:

<table class="table custom-table m-0">
  <thead>
    <tr>
      <th>Description</th>
      <th>Make</th>
      <th>UOM</th>
    </tr>
  </thead>
  <tbody>

    <?php 
    $one=explode(',', $row['description']);
    $two=explode(',', $row['make']);
    $three=explode(',', $row['uom']);
    foreach($one as $ones) {
     ?>
    <tr>
      <td>
        <?php echo $ones?>
      </td>
      <td></td>
      <td></td>

    </tr>
    <?php }?>
  </tbody>
</table>

这里只能获取第一列的值,谁能告诉我如何从所有三列中获取值,在此先感谢

使用计数器 - 假设每行的条目数完全相同

http://sandbox.onlinephpfunctions.com/code/555be47daf3bc3e99d496585f702bfc9dfae4e4e

<? 
$one=explode(',', $row['description']);
$two=explode(',', $row['make']);
$three=explode(',', $row['uom']);    
$i=0;
?>

<table class="table custom-table m-0">
  <thead>
    <tr>
      <th>Description</th>
      <th>Make</th>
      <th>UOM</th>
    </tr>
  </thead>
  <tbody>

    <?php 
    foreach($one as $ones) {
     ?>
    <tr>
      <td><?php echo $ones; ?></td>
      <td><?php echo $two[$i]?></td>
      <td><?php echo $three[$i]?></td>

    </tr>
    <?php $i++;}?>
  </tbody>
</table>