任何人都可以帮助我在PHP / HTML上列出这些数据,因为我只能获得未制定的原始数据。这是我正在使用的代码:
// Price and Flight Select Statements
$pricesql = "select PriceID,RouteID,ClassID,Price from price;";
$printpricesql=mysqli_query($connect,$pricesql);
while($row=mysqli_fetch_array($printpricesql))
{
echo $row['PriceID'];
echo $row['RouteID'];
echo $row['ClassID'];
echo $row['Price'];
}
$flightsql = "select flightid,routeid,departuredate,arrivaldate from
flightschedule;";
$printflightsql=mysqli_query($connect,$flightsql);
while($row=mysqli_fetch_array($printflightsql))
{
echo $row['flightid'];
echo $row['routeid'];
echo $row['departuredate'];
echo $row['arrivaldate'];
}
答案 0 :(得分:1)
// Price and Flight Select Statements
$pricesql = "select PriceID,RouteID,ClassID,Price from price";
$printpricesql=mysqli_query($connect,$pricesql);
echo '<table>';
// headers
echo '<tr>';
echo '<th>Price Id</th>';
echo '<th>Route Id</th>';
echo '<th>Class Id</th>';
echo '<th>Price</th>';
echo '</tr>';
while($row=mysqli_fetch_array($printpricesql)) {
echo '<tr>';
echo '<td>'.$row['PriceID'].'</td>';
echo '<td>'.$row['RouteID'].'</td>';
echo '<td>'.$row['ClassID'].'</td>';
echo '<td>'.$row['Price'].'</td>';
echo '</tr>';
}
echo '</table>';
$flightsql = "select flightid,routeid,departuredate,arrivaldate from flightschedule";
$printflightsql=mysqli_query($connect,$flightsql);
echo '<table>';
// headers
echo '<tr>';
echo '<th>Flight Id</th>';
echo '<th>Route Id</th>';
echo '<th>Departure Date</th>';
echo '<th>Arrival Date</th>';
echo '</tr>';
while($row=mysqli_fetch_array($printflightsql)) {
echo '<tr>';
echo '<td>'.$row['flightid'].'</td>';
echo '<td>'.$row['routeid'].'</td>';
echo '<td>'.$row['departuredate'].'</td>';
echo '<td>'.$row['arrivaldate'].'</td>';
echo '</tr>';
}
echo '</table>';