From bb039b6edfd4c58591616937c6962240ce93419f Mon Sep 17 00:00:00 2001 From: freedomfeather <fadlurohmanakmal@rocketmail.com> Date: Sat, 7 Oct 2017 01:52:17 +0700 Subject: [PATCH] Membuat bagian untuk menampilkan list preferred location --- css/profile.css | 3 +++ profile/profile.php | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/css/profile.css b/css/profile.css index 67b7397b..d4eab3cf 100755 --- a/css/profile.css +++ b/css/profile.css @@ -24,6 +24,9 @@ .prefloc_container { height: 50%; } +.prefloc_container ul { + list-style-type: none; +} .edit_prefloc_button { float: right; margin-top: 10px; diff --git a/profile/profile.php b/profile/profile.php index 4ea93cd7..b3a91e37 100644 --- a/profile/profile.php +++ b/profile/profile.php @@ -20,7 +20,6 @@ $username = $row['username']; include("../template/header.php"); } - mysqli_close($con); ?> </div> <div class="menu_container"> @@ -58,6 +57,30 @@ <div class="title"><h1>Preferred Locations</h1></div> <div class="edit_prefloc_button"><a href=<?php echo 'edit_location.php?id='.$user_id; ?>>✎</a></div> </div> + <div class="prefloc_list"> + <?php + $query=mysqli_query($con,"SELECT pref_loc FROM driver_prefloc WHERE driver_id='".$user_id."'") or die(mysqli_error()); + $numrows = mysqli_num_rows($query); + if($numrows !=0) + { + $i = 1; + $buffer = '<ul>'; + while ($row=mysqli_fetch_assoc($query)) { + if ($i != $numrows) { + $buffer .= '<li>►'.$row['pref_loc'].'</li><ul>'; + $i++; + } else { + $buffer .= '<li>►'.$row['pref_loc'].'</li>'; + } + } + for ($i = 0;$i <= $row; $i++) { + $buffer .= '</ul>'; + } + echo $buffer; + } + mysqli_close($con); + ?> + </div> </div> </div> </body> -- GitLab