内部while循环数据不在php中显示

时间:2015-03-11 12:34:55

标签: php

嗨,在下面我想显示咨询费用值,因为我拿了td.But,因为td没有显示任何东西,甚至td也没有显示。

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

我的预期输出:

比尔特别账单子特别医生日期Dis。金额。

咨询费用:

所有基于行数的值。

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>   

1 个答案:

答案 0 :(得分:0)

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

你的变量甚至没有在你的代码中定义。