我正在用 PHP 编写汽车租赁脚本,我将所有汽车放在一个 SQL 表中,将所有汽车租赁放在另一个表中。如何在汽车下方显示所有租赁?
**Like this:**
bilar.reknr / Marke / Modell
starttid / stop tid
starttid / stop tid
starttid / stop tid
bilar.reknr / Marke / Modell
starttid / stop tid
starttid / stop tid
**EX**
ZOG-933 / BMW / 320
26.3.2013 / 27.3.2013
28.3.2013 / 29.3.2013
30.3.2013 / 31.3.2013
GOD-123 / MAZDA / 6
1.4.2013 / 2.4.2013
5.4.2013 / 6.4.2013
这是我现在的代码:
<?php
include 'connection.php';
$sqlquery = "SELECT * FROM bilar";
$sqlarray = mysql_query($sqlquery);
print "<table border='1'><tr>";
print "<td>Register nummer</td>";
print "<td>Marke</td>";
print "<td>Modell</td>";
print "<td>arsmodell</td>";
print "<td>personer</td>";
print "<td>fel</td>";
print "</tr>";
while ($row = mysql_fetch_array($sqlarray)) {
print "<tr style='font-weight:bold;'>";
//print "<td>" . $row['reknr'] . "</td>";
print "<td>" . $row['marke'] . "</td>";
print "<td>" . $row['modell'] . "</td>";
print "<td>" . $row['arsmodell'] . "</td>";
print "<td>" . $row['personer'] . "</td>";
print "<td>" . $row['fel'] . "</td>";
print "</tr>";
$iddd=$row['reknr'];
$sqlquery = "SELECT * FROM hyr";
$sqlarray = mysql_query($sqlquery);
while ($row = mysql_fetch_array($sqlarray)) {
if ($row['reknr']=$row['reknr1']){
print "<tr>";
print "<td>" . $row['startdat'] . "-" . $row['stopdat'] . "</td>";
print "<td>" . $row['starttid'] . "-" . $row['stoptid'] . "</td>";
print "</tr>";
}
}
}
print "</table>";
mysql_close();
?>