-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser_search.php
28 lines (26 loc) · 1.04 KB
/
user_search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
session_start();
?>
<?php
$search=$_GET['search'] ;
$con=new mysqli("localhost","root","","car_rental");
$type_data = mysqli_query($con,"SELECT c.car_id, number_plate,image,company,model,price FROM car c,inventory i where c.car_id = i.car_id and i.availability >= 1 and (company like '%$search%'
OR model like '%$search%' OR car_type like '%$search%' OR price like '%$search%')");
$count=0;
while ($row = mysqli_fetch_array($type_data))
{
$imageSrc = "car_images/" . $row['image'];
$count = $count +1;
echo "<div class='row'>";
echo '<div class="col-sm-4"><img src="'.$imageSrc.'" alt="image_coming_soon" style="width:250px;height:180px;"><p>'.$row['company'].'
'.$row['model'].'</br>$'.$row['price'].'</br>
<a href= "scar_initialize.php?number_plate='.$row['number_plate'].'&price='.$row['price'].'" class="btn btn-default"
id="addtocart" style="color:rgb(28, 183, 255);" type="button" value="'.$row['car_id'].'">Add To Cart</a></div>' ;
if($count == 3){
$count =0;
echo "</div>";
echo "<div class='row'>";
}
}
mysqli_close($con);
?>