我正在开发一个预订系统,我正在尝试构建它的数组以在单独的表中打印出每日约会,例如在如所附图像的表中显示的今天的预订。下面还有一张明天的桌子,依此类推。 这是我的SQL查询
<?php
//use mysqli->affected_rows
for ($x = 1; $x <= $mysqli->affected_rows; $x++) {
$rows[] = $result->fetch_assoc();
}
//this will return a nested array
// print_r($rows);
//echo"$rows";
$stat = $mysqli->query("SELECT * FROM `bookings` group by Where date>1");
foreach($rows as $rows) {
if ($stat) {
echo' <table class="table table-bordered table-striped">
<tr>
<th>Name</th>
<th>Address</th>
<th>Phone</th>
<th>Service</th>
<th>Notes</th>
<th>Date</th>
<th>Actions</th>
<th>Update</th>
</tr>';
echo'<tr>';
echo'<td>'. $rows['name']."</td>";
echo'<td>'. $rows['siteAddre'].'</td>';
echo'<td>'. $rows['phone'].'</td>';
echo'<td>'. $rows['service'].'</td>';
echo'<td>'. $rows['comments'].'</td>';
echo'<td>'.date('h:i',strtotime($rows['start']))."<br>". date('d-m',strtotime($rows['date'])).'<br>'.'</td>';
echo'<td>'. $rows['status'].'</td>';
echo'<td>'. $rows['status'].'</td>';
echo'<tr>';
}else{
// I need the sql query or php if statement to join only the column to the table header
// I hav
echo' <table class="table table-bordered table-striped">
<tr>
<th>Name</th>
<th>Address</th>
<th>Phone</th>
<th>Service</th>
<th>Notes</th>
<th>Date</th>
<th>Actions</th>
<th>Update</th>
</tr>';
echo'<td>'. $rows['name']."</td>";
echo'<td>'. $rows['siteAddre'].'</td>';
echo'<td>'. $rows['phone'].'</td>';
echo'<td>'. $rows['service'].'</td>';
echo'<td>'. $rows['comments'].'</td>';
echo'<td>'.date('h:i',strtotime($rows['start']))."<br>". date('d-m',strtotime($rows['date'])).'<br>'.'</td>';
echo'<td>'. $rows['status'].'</td>';
echo'<tr>';
}
echo '</tbody>';
echo '</table> ';
}
?>
我不希望在2018年10月26日的第二次预订中再次打印表头。 如果不清楚,请查看图片
Please click here to see the print screen
提前谢谢