У меня есть PHP-скрипт, который запускает цикл for и выводит строки и данные HTML-таблицы.Однако я получаю случайные случаи, когда разрыв строки вставляется в строку таблицы, когда я делаю печать / предварительный просмотр, и я не знаю почему.Похоже, что в браузере все отлично отображается ... Посмотрите на скриншот предварительного просмотра печати для строки 7. Я попытался указать высоту 0
![enter image description here](https://i.stack.imgur.com/V9mzv.png)
Воткод, который я использую в PHP:
$counter = 1;
$tCounter = 1;
$pCounter = 1;
$tc=9;
for($i=0; $i<count($spiceType); $i++){
$result = mysql_query("SELECT * FROM `spices` WHERE `type`='$spiceType[$i]' ORDER BY ID")or die(mysql_error());
$spiceCat = $spiceType[$i];
echo '<tr>
<td colspan="6" ><p class="cat" >'.$spiceCat.'</p></td>
<tr>';
while($r=mysql_fetch_array($result)){
$pname = $r[productName];
$qty = $r[qty];
$price = $r[price];
$upcNum = $r[upcNumber];
$imageName = substr($upcNum, 0, -1);
$imageName = "0".$imageName.".jpg";
echo'
<tr height="0">
<td width="25"><p class="counter">'.$counter.'</counter></td>
<td width="200"><p class="productName"><a href="edit.php?upc='.$upcNum.'&pn='.$pname.'" class="links" name="'.$pname.'">'.$pname.'</a></p></td>
<td width="50"><p class="qty">'.$qty.'</p></td>
<td width="100"><p class="price">'.$price.'</p></td>
<td width="25"><p class="upc">'.$upcNum.'</p></td>
<td width="50" align="center"><img src="upcjpeg/'.$imageName.'" style="width: 85%; height: inherit; vertical-align:text-top"></td>
<tr>';
if($tCounter==$tc){
$tCounter=1;
$tc=11;
echo'
</table>
<p align="right">Page: '.$pCounter.'
<div class="page-break"></div>
<table width="1024" class="sample">
<tr border="0" cellpadding="0">
<th width="25"><h2><p align="center">#</p></h2></th>
<th width="200"><h2><p align="center">Product Name</p></h2></th>
<th width="50"><h2><p align="center">Qty</p><h2></th>
<th width="100"><h2><p align="center">Price</p><h2></th>
<th width="25"><h2><p align="center">UPC No.</p><h2></th>
<th width="50"><h2><p align="center">Barcode</p><h2></th>
</tr>
<tr>
<td colspan="6" bgcolor=#E0E0E0><p class="catCont">'.$spiceCat.'(cont.)</p></td>
<tr>';
$pCounter++;
} else {
$tCounter++;
}
$counter++;
}
}