Skip to content
Snippets Groups Projects
Commit 96a2ece3 authored by Husnulzaki Wibisono Haryadi's avatar Husnulzaki Wibisono Haryadi
Browse files

Insert function to display other driver

parent 37a3e5ee
1 merge request!45OneHundred - 13515005 - Husnulzaki Wibisono Haryadi
...@@ -67,6 +67,41 @@ ...@@ -67,6 +67,41 @@
echo "<h3>Nothing to display :(</h3>"; 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'>&starf;".$driver_rating." (".$driver_votes." votes)</p>
<div class='choose_driver green' onclick='chooseDriver(".$driver_id.")'>
I CHOOSE YOU
</div>
</td>
</tr>
</table>
";
}
}
}
?> ?>
</div> </div>
<div class="menu_container"> <div class="menu_container">
...@@ -121,6 +156,7 @@ ...@@ -121,6 +156,7 @@
</div> </div>
<div id="other_driver"> <div id="other_driver">
<h2>Other drivers</h2> <h2>Other drivers</h2>
<?php ShowRegDrv($con, $user_id) ?>
</div> </div>
<input type="hidden" name="picking_point" value=<?php echo $ppoint ?>> <input type="hidden" name="picking_point" value=<?php echo $ppoint ?>>
<input type="hidden" name="destination" value=<?php echo $dest?>> <input type="hidden" name="destination" value=<?php echo $dest?>>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment