制表数据MySQL PHP

Anyone can help me out in tabulating this data on PHP/HTML as I am only able to get to raw data which is not formulated. This is the code I am using:

// 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'];
 }
// 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>';