diff --git a/order/select_driver.php b/order/select_driver.php index e62a5e2aa4f058ee210f0219c99bf5670039454a..962cd20a095af3bb9570bdf8151f8cc62f3fb1dd 100644 --- a/order/select_driver.php +++ b/order/select_driver.php @@ -67,6 +67,41 @@ echo "<h3>Nothing to display :(</h3>"; } } + + function ShowRegDrv($con, $user_id) + { + $rdQuery = mysqli_query($con, "SELECT * FROM driver INNER JOIN user ON driver_id = user_id") or die(mysqli_error($con)); + + while ($row = mysqli_fetch_assoc($rdQuery)) { + $driver_id = $row['driver_id']; + $driver_name = $row['name']; + $driver_votes = $row['votes']; + $driver_rating = ($driver_votes == 0) ? 0 : $row['total_score']/$row['votes']; + if ($driver_id != $user_id) { + echo + " + <table class='driver_table'> + <colgroup> + <col style='width: 20%;'> + <col style='width: 80%;'> + </colgroup> + <tr> + <td> + <img class='driver_pict' src='../profile/getProfilePict.php?id=".$driver_id."' + </td> + <td class='driver_column'> + <p class='driver_username'>".$driver_name."</p> + <p class='driver_rating'>★".$driver_rating." (".$driver_votes." votes)</p> + <div class='choose_driver green' onclick='chooseDriver(".$driver_id.")'> + I CHOOSE YOU + </div> + </td> + </tr> + </table> + "; + } + } + } ?> </div> <div class="menu_container"> @@ -121,6 +156,7 @@ </div> <div id="other_driver"> <h2>Other drivers</h2> + <?php ShowRegDrv($con, $user_id) ?> </div> <input type="hidden" name="picking_point" value=<?php echo $ppoint ?>> <input type="hidden" name="destination" value=<?php echo $dest?>>