0

The code is not working

This code is search filter in php and mysql it is supoosed to retrieve the result from the database accrding to the search but it does not return anything PLEASE HELP ME here is the code : $brand=$_POST['brand']; $model_name=$_POST['model_name']; $model_year=$_POST['model_year']; $category=$_POST['category']; $color=$_POST['color']; $sql = "SELECT * FROM vehicle WHERE vehicle.Make=:brand AND vehicle.Model_name=:model_name AND vehicle.Model_year=:model_year AND vehicle.Vehicle_category_name=:category AND vehicle.Colour=:color"; $query = $dbh -> prepare($sql); $query -> bindParam(':brand',$brand, PDO::PARAM_STR); $query -> bindParam(':model_name',$model_name, PDO::PARAM_STR); $query -> bindParam(':model_year',$model_year, PDO::PARAM_STR); $query -> bindParam(':category',$category, PDO::PARAM_STR); $query -> bindParam(':color',$color, PDO::PARAM_STR); $query->execute(); $results=$query->fetchAll(PDO::FETCH_OBJ); $cnt=$query->rowCount(); ?> <p><span><?php echo htmlentities($cnt);?> Listings</span></p> </div> </div> <?php if($query->rowCount() != 0) { foreach($results as $result) { ?> <div class="product-listing-m gray-bg"> <div class="product-listing-img"><img src="admin/img/vehicleimages/<?php echo htmlentities($result->image);?>" class="img-responsive" alt="Image" /> </a> </div> <div class="product-listing-content"> <h5><a href="vehical-details.php?vhid=<?php echo htmlentities($result->plate_number);?>"><?php echo htmlentities($result->Make);?> , <?php echo htmlentities($result->Model_name);?></a></h5> <p class="list-price">SR<?php echo htmlentities($result->Cost_per_day);?> Per Day</p> <ul> <li><i class="fa fa-user" aria-hidden="true"></i><?php echo htmlentities($result->No_of_person);?> seats</li> <li><i class="fa fa-calendar" aria-hidden="true"></i><?php echo htmlentities($result->Model_year);?> model</li> <li><i class="fa fa-car" aria-hidden="true">

27th Jan 2020, 10:48 AM
violet rose
violet rose - avatar
3 Answers
+ 1
your chance for help will grow if u hack the code into the code section. If it doesnt serve it, SL might be the wrong place for your prob.
27th Jan 2020, 11:04 AM
Oma Falk
Oma Falk - avatar
0
Can you please not copy all of your code, and explain to me what you are trying to achieve and what is the result of your code, please?
27th Jan 2020, 10:56 AM
coddy
coddy - avatar