<?php
include('connexion.php');
include('security.php');
include('includes/header.php');
include('includes/navbar.php');
?>
<body>
<?php
if(isset($_POST["approved"]))
{
$id_location=$_POST['id_location'];
$sql="UPDATE location SET etat = 'Approved' WHERE id_location = '$id_location'";
mysqli_query($connection,$sql);
}
if(isset($_POST["rejected"]))
{
$id_location=$_POST['id_location'];
$sql="UPDATE location SET etat='Rejected' WHERE id_location = '$id_location'";
mysqli_query($connection,$sql);
}
?>
<div class="container-fluid">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">
Rentals</h6>
</div>
<div class="card-body">
<div class="container">
<div class="row justify-content-center">
<?php
/*$query="SELECT * from voiture v,location l,user u where v.id_voiture=l.id_voiture AND l.id_user=u.id_user";
*/
$query="select * from (voiture v right join location l on (v.id_voiture=l.id_voiture)) inner join user u on (l.id_user=u.id_user)";
$query_run=mysqli_query($connection,$query);
if(mysqli_num_rows($query_run)>0){
?>
<table class="table">
<thead>
<tr><th>User</th>
<th>Car</th>
<th>Modele</th>
<th>Type</th>
<th>mileage</th>
<th>prix</th>
<th>from date</th>
<th>to date</th>
<th>person</th>
<th>luggage</th>
<th>status</th>
<th >accept</th>
<th >Delete</th>
</tr>
</thead>
<tbody>
<?php
while ($row=mysqli_fetch_assoc($query_run)) {
?>
<tr>
<td><?php echo $row['username'];?></td>
<td><?php echo $row['nom'];?></td>
<td><?php echo $row['model'];?></td>
<td><?php echo $row['type'];?></td>
<td><?php echo $row['kilometrage'];?></td>
<td><?php echo $row['prix'];?></td>
<td><?php echo $row['from_date'];?></td>
<td><?php echo $row['to_date'];?></td>
<td><?php echo $row['person'];?></td>
<td><?php echo $row['luggage'];?></td>
<td><?php echo $row['etat'];?></td>
<td><form method="post" action="">
<input type="hidden" name="id_location" value="<?php echo $row['id_location']; ?>">
<button type="submit" name="approved" class="btn btn-success" >approved</button></form></td>
<td><form method="post" action="">
<input type="hidden" name="id_location" value="<?php echo $row['id_location']; ?>">
<button type="submit" name="rejected" class="btn btn-danger" >reject</button></form></td>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
</div>
</form>
<?php include('includes/scripts.php');
?>
IbtiSsam 0 Newbie Poster
Dani 4,310 The Queen of DaniWeb Administrator Featured Poster Premium Member
IbtiSsam 0 Newbie Poster
rproffitt 2,662 "Nothing to see here." Moderator
IbtiSsam 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.