-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfull_search.php
More file actions
35 lines (33 loc) · 1.6 KB
/
Copy pathfull_search.php
File metadata and controls
35 lines (33 loc) · 1.6 KB
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
29
30
31
32
33
34
<?php
include_once('db_conn.php');
$conn = connect_to_db();
$text = $_POST['text'];
$query = "SELECT * FROM posts WHERE match(city, state, make, model) against ('".$text."')";
$result = mysqli_query($conn,$query);
$return = '<table class="table table-dark table-bordered"';
$return = $return.' '.'<thead><tr>
<th scope="col">Post #</th>
<th scope="col">Make</th>
<th scope="col">Model</th>
<th scope="col">Year</th>
<th scope="col">Price</th>
<th scope="col">Milage</th>
<th scope="col">City</th>
<th scope="col">State</th>
<th scope="col">VIN</th>
</tr></thead>';
foreach($result as $row) {
$return = $return.' '."<tr><td>".$row['post_id']."</td>
<td id='make_".$row['post_id']."' class='".$row['post_id']." editable'>".$row['make']."</td>
<td id='model_".$row['post_id']."' class='".$row['post_id']." editable'>".$row['model']."</td>
<td id='year_".$row['post_id']."' class='".$row['post_id']." editable'>".$row['year']."</td>
<td id='price_".$row['post_id']."' class='".$row['post_id']." editable'>".$row['price']."</td>
<td id='miles_".$row['post_id']."' class='".$row['post_id']." editable'>".$row['mileage']."</td>
<td id='city_".$row['post_id']."' class='".$row['post_id']." editable'>".$row['city']."</td>
<td id='state_".$row['post_id']."' class='".$row['post_id']." editable'>".$row['state']."</td>
<td id='vin_".$row['post_id']."' class='".$row['post_id']." editable'>".$row['VIN']."</td>
<td><button type='button' onclick=redir(".$row['post_id'].") class='btn btn-success'>View</button></td></tr>";
}
$return = $return.' '. "</table>";
echo $return;
?>