如何在foreach条件下去除多余的td细胞

时间:2017-11-22 02:58:19

标签: php codeigniter foreach

如何删除图像上的多余td单元格,Price Vat Inc.和Total的行数基于计数,count基于productid的数量,如您在给定代码中所见。

This is my Screenshot

这是我的PHP代码:

$quoteproducts = $this->pmis->get_Squoteproducts1($projectquoteid,'consumables');
$q1 = $this->pmis->get_Squoteproducts2($projectquoteid,'consumables');
//var_dump($q1[0]['cnt']);
$cnt = $q1[0]['cnt'];
$total=0;
$ctr = 1;
$last_key = '';
if($quoteproducts){
    foreach($quoteproducts as $q){
        $current_key = 0;
        $subtotal = $q['price'] * $q['qty'];
        //echo $q['stock'];
        $strval .='
        <tr>
        <td align="center">'.$ctr.'</td>
        <td  class="d1">'.$q['productname'].'</td>

        <td align="center" class="d1">'.$q['qty'].'</td>
        <td align="center" class="d1">'.$q['unit'].'</td>


        <td align="center" rowspan="'.$cnt.'"></td>
        <td align="center" rowspan="'.$cnt.'"></td>

        </tr>
        ';
        $ctr ++;
        $total = $subtotal + $total;
    }       
}

1 个答案:

答案 0 :(得分:0)

从表中删除rowspan。这是由于使用rowspan。