From 89516b32527b2619b00c490240fafbd3dd8c7872 Mon Sep 17 00:00:00 2001
From: "fariz.tumbuan" <13515050@std.stei.itb.ac.id>
Date: Sat, 7 Oct 2017 03:47:37 +0800
Subject: [PATCH] driver_history.php sudah menampilkan pelanggan yang pernah
 diantar

---
 history/driver_history.php | 73 ++++++++++++++------------------------
 1 file changed, 27 insertions(+), 46 deletions(-)

diff --git a/history/driver_history.php b/history/driver_history.php
index a2812c70..d1e4a056 100644
--- a/history/driver_history.php
+++ b/history/driver_history.php
@@ -21,7 +21,6 @@
                     $username = $row['username'];
                     include("../template/header.php");
                 }
-                mysqli_close($con);
             ?>
 		</div>
 		<div class="menu_container">
@@ -53,51 +52,33 @@
                     </colgroup>
 
                     <tbody>
-                        <tr>
-                            <td>
-                                <img class="history_pict" src="../img/default_profile.jpeg">
-                            </td>
-                            <td class="history_column">
-                                <p class="history_date">tanggal</p>
-                                <p class="history_username">Username</p>
-                                <p class="history_loc">asal - tujuan</p>
-                                <p class="history_rating">rating</p>
-                                <p class="history_comment">You commented:</p>
-                                <p class="history_comment" style="margin-left: 30px;">ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
-                                tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
-                                </p>
-                            </td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <img class="history_pict" src="../img/default_profile.jpeg">
-                            </td>
-                            <td class="history_column">
-                                <p class="history_date">tanggal</p>
-                                <p class="history_username">Username</p>
-                                <p class="history_loc">asal - tujuan</p>
-                                <p class="history_rating">rating</p>
-                                <p class="history_comment">You commented:</p>
-                                <p class="history_comment" style="margin-left: 30px;">ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
-                                tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
-                                </p>
-                            </td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <img class="history_pict" src="../img/default_profile.jpeg">
-                            </td>
-                            <td class="history_column">
-                                <p class="history_date">tanggal</p>
-                                <p class="history_username">Username</p>
-                                <p class="history_loc">asal - tujuan</p>
-                                <p class="history_rating">rating</p>
-                                <p class="history_comment">You commented:</p>
-                                <p class="history_comment" style="margin-left: 30px;">ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
-                                tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
-                                </p>
-                            </td>
-                        </tr>
+                        <?php
+                            $query_order=mysqli_query($con,"SELECT * FROM `order` WHERE `driver_id`='".$user_id."'") or die(mysqli_error($con));
+
+                            if(mysqli_num_rows($query_order)!=0)
+                            {
+                                while($row=mysqli_fetch_assoc($query_order)) {
+                                    $driver_query=mysqli_query($con,"SELECT username FROM user WHERE user_id='".$row['cust_id']."'") or die(mysqli_error());
+                                    $driver_row=mysqli_fetch_assoc($driver_query);
+                                    $driver_name=$driver_row['username'];
+                                    echo
+                                        "<tr>
+                                            <td>
+                                                <img class='history_pict' src='../profile/getProfilePict.php?id=".$row['cust_id']."'
+                                            </td>
+                                            <td>
+                                                <p class='history_date'>".$row['date']."</p>
+                                                <p class='history_username'>".$driver_name."</p>
+                                                <p class='history_loc'>".$row['pick_city']." - ".$row['dest_city']."</p>
+                                                <p class='history_rating'>rating ".$row['score']."</p>
+                                                <p class='history_comment'>You commented:</p>
+                                                <p class='history_comment' style='margin-left: 30px;'>".$row['comment']."</p>
+                                            </td>
+                                        </tr>";
+                                }
+                            }
+                            mysqli_close($con);
+                        ?>
                     </tbody>
                 </table>
             </div>
-- 
GitLab