[英]While loop for TCPDF
I have problem to loop the data in TCPDF..The output should be display like this 我在循环TCPDF中的数据时遇到问题。输出应显示如下
Output : 输出 :
Chair x 3
Table x 5
LCD X 2
but output now just show : Chair x 3
但现在输出仅显示:
Chair x 3
It only display the first record. 它仅显示第一条记录。 Can anyone explain how to loop the data based on output above?
谁能解释如何根据上面的输出循环数据?
$result_1=mysql_query($query_1);
while($row1=mysql_fetch_array($result_1)){
$item = $row1['item'];
$qty = $row1['SUM(qty)'];
$data = $item.' x '.$qty;
$tbl.='<td align="center">'.$data.'</td>';
$data='';
}
$tbl.='</tr>';
}
This picture output I get based on coding above 我根据上面的编码获得的图片输出
This is answer for my question. 这是我的问题的答案。 I just add $data.
我只添加$ data。 at
在
$data = $item.' $ data = $ item。” x '.$qty;
x'。$ qty;
and my problem has been solved. 我的问题已经解决了。
$result_1=mysql_query($query_1);
while($row1=mysql_fetch_array($result_1)){
$item = $row1['item'];
$qty = $row1['SUM(qty)'];
$data = $data.$item.' x '.$qty.'<br>';
}
$tbl.='<td align="center">'.$data.'</td>';
$data='';
$tbl.='</tr>';
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.