内部 while 循环数据未在 PHP 中显示


inside while loop data not displaying in php

嗨,在下面,我想显示我参加TD的咨询费用值。但是在那个td没有disdis任何东西,甚至td也没有显示。

执行此查询后,我想根据要显示数据的行找到行数。

我的预期输出:

比尔 特别

比尔 子 特别 医生 日期 dis. amt.

咨询费用:

基于行数的所有值。

.php

<table width="100%">
            <th>Bill Particular</th>
            <th>Bill Sub Particular</th>
            <th>Doctor</th>
            <th>Date</th>
            <th>Dis. Amt.</th>
            <th>Charge</th>
            <th>No. of Times</th>
            <th>Amount</th>
        </table>
<tr><th colspan=2>Consultation Charges:</th>
            <?php
            $div_options = array();
                $sql = "SELECT ibp.ipd_bp_id, ibp.bp_id, bp.bp_name, ibp.bsp_id, bsp.bsp_name, ibp.doctor_id, ab.employee_name doctor, ibp.date date, ibp.amount charge, ibp.discount_amount discount, ibp.no_of_time, (ibp.no_of_time * ibp.amount) total_amount
FROM bill_particular_master bp
INNER JOIN ipd_bill_particular ibp ON ibp.bp_id = bp.bp_id
LEFT OUTER JOIN bill_sub_particular bsp ON bsp.bsp_id = ibp.bsp_id
LEFT OUTER JOIN address_book ab ON ab.employee_id = ibp.doctor_id
WHERE ibp.ipd_reg_no =  '$ipd_no'
AND bsp.consultant =1
AND bsp.package = 0
AND bsp.admission = 0
AND bp.bp_name != 'Scan Charges' 
AND bp.bp_name !='Procedure'";
            $sth = $dbh->query($sql);
            //$row=$dbh->fetch();
            $i=1;
            while($row=$sth->fetch(PDO::FETCH_ASSOC)){
            $sub_arr['bp_name'] = $row['bp_name'];  
            $sub_arr['bsp_name'] = $row['bsp_name'];
            echo "<tr>
            <td>Here is the text - " . $sub_arr['bp_name'] . "</td> 
            <td>The ID of the text is - " .$sub_arr['bsp_name'] . "</td>";
            if($i !== 0) { 
            echo "<td>The ID of the previous entry is - " .$sub_arr['bp_name'] . "</td>";
            } 
            else { 
            echo "<td>&nbsp;</td>";
            } 
            echo "</tr>"; 
            $i = $row['bp_name']; 
            }
            ?>

        </tr>   
echo "<td>The ID of the previous entry is - " . $row['bp_name'] . "</td>";

您有甚至未在代码中定义的变量。