【发布时间】:2012-03-31 18:55:03
【问题描述】:
我是 TCPDF 的新手。我面临的一个小问题是所有输出数据都显示同一行。我的意思是第一条记录重复数据库中存在的总数据(行)的次数。这是我的代码
$tbl_header = '<style>
table {
border-collapse: collapse;
border-spacing: 0;
margin: 0 20px;
}
tr {
padding: 3px 0;
}
th {
background-color: #CCCCCC;
border: 1px solid #DDDDDD;
color: #333333;
font-family: trebuchet MS;
font-size: 30px;
padding-bottom: 4px;
padding-left: 6px;
padding-top: 5px;
text-align: left;
}
td {
border: 1px solid #CCCCCC;
font-size: 25px;
padding: 3px 7px 2px;
}
</style>
<table id="gallerytab" width="600" cellspacing="2" cellpadding="1" border="0">
<tr>
<th><font face="Arial, Helvetica, sans-serif">Products Title</font></th>
<th><font face="Arial, Helvetica, sans-serif">Product Specs</font></th>
<th><font face="Arial, Helvetica, sans-serif">Product Price</font></th>
<th><font face="Arial, Helvetica, sans-serif">Products Image</font></th>
</tr>';
$tbl_footer = '</table>';
$tbl = '';
while ($row_Pro_Record = mysql_fetch_assoc($Pro_Record)) {
$tbl .= '
<tr>
<td>'.$p_title.'</td>
<td>'.$p_size.'</td>
<td>'.$p_price.'</td>
<td><img width="120"src="http://localhost/product/images/'.$c_name.'/'.$p_image.'.jpg"></td>
</tr>
';
}
// output the HTML content
$pdf->writeHTML($tbl_header . $tbl . $tbl_footer, true, false, false, false, '');
这可能是我缺少的一个愚蠢的小细节,因为我的 php/mysql 技能不是那么好。任何帮助将不胜感激,在此先感谢:)
【问题讨论】: