我正在尝试从 php+mysql 生成单词。我找到了生成它的代码,并且有 3 个查询。我想在每个循环中更改页面。那可能吗?现在我正在使用<hr>
将其分开。在示例中,我只有 2 个大循环,但在我的页面中,我有 10 个循环,并且我想要 1 个单词中的 1 个循环。这是我的代码
<?php
header("Content-type: application/vnd.ms-word");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; Filename=printorders.doc");
?>
<?php
include 'connection.php';
$result = $connection->query('SELECT * FROM main WHERE (orderid = "100000002" OR orderid = "100000003") GROUP BY orderid ORDER BY orderid'); ?>
<?php while($row = $result->fetch_array()) {
$result3 = $connection->query("SELECT orderid, BillingStreet, City, Region FROM main WHERE BillingTelephone = '".$row["BillingTelephone"]."' group by orderid ORDER BY `main`.`orderdate` ASC ");
while($row3 = $result3->fetch_assoc()) {
$city = $row3["City"];
$region = $row3["Region"];
$address = $row3["BillingStreet"];
$idorder = $row3["orderid"];
}
?>
<table border="1" width="100%" cellpadding="10" cellspacing="0" align="center" id="tbl">
<thead>
<tr>
<th>id</th>
<th>date</th>
<th>name</th>
<tr>
</thead>
<tbody>
<tr>
<td style="text-align:center;"><?php echo $idorder;?></td>
<td style="text-align:center;"><?php echo $row["insert_date"];?></td>
<td style="text-align:center;"><?php echo $row["CustomerName"];?></td>
</tr>
</tbody>
</table>
<hr style="color: #f00;background-color: #f00;height: 10px;"> <!--here i want to change page-->
<?php
}
?>
最佳答案
如果你想使用分页符,可以添加这一行
<br style="page-break-before: always">
关于php生成word文档更改页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33275358/