dtkmejg127475 2015-03-11 12:34
浏览 53

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

Hi in the below i want to show Consultation Charges values for that i took the td.But in that td not displying anything even td also not showing.

After executing this query i want to find the no. of rows based on the rows i want to display the data.

My expected output:

Bill Particular Bill Sub Particular Doctor Date Dis. Amt.

Consultation Charges:

all the values based on no of rows.

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条回答 默认 最新

  • dtlc84438 2015-03-11 12:43
    关注
    echo "<td>The ID of the previous entry is - " . $row['bp_name'] . "</td>";
    

    You have there variable thats not even defined in your code.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据