You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$sql = "SELECT TOP 5 [from],[to], COUNT(*) as count, AVG(cost/passengers) as average_cost FROM bookings WHERE class = ? GROUP BY [from],[to] ORDER BY count DESC";
$params = array($selectedClass);
$stmt = sqlsrv_query($conn, $sql, $params);
echo "<table>";
echo "<tr>
<th>From</th>
<th>To</th>
<th>Average Cost</th>
</tr>";
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {