i have following PHP file,it work well,all output is showing up,but i have problem with IF statement.i dont know why its showing up with all text of both IF statement and both row of stars (font awesome icons).Why is it happening,can someone be so kind to help me,where do i have to put IF to make if work,???thanks
<?php
include('database_connection.php');
if(isset($_POST["action"]))
{
$query = "
SELECT * FROM items WHERE product_status = '1'
";
if(isset($_POST["brands"]))
{
$brand_filter = implode("','", $_POST["brands"]);
$query .= " AND product BETWEEN '400' AND '600' ";
}
$statement = $connect->prepare($query);
$statement->execute();
$result = $statement->fetchAll();
$total_row = $statement->rowCount();
$output = '';
if($total_row > 0)
{
foreach($result as $row)
{
$output .= '
<div class="col-sm-4 col-lg-3 col-md-3">
<div style="border:1px solid #ccc; border-radius:5px; padding:16px; margin-bottom:16px; height:450px;">
<p align="center"><strong><a href="#">'. $row['hotel_name'] .'</a></strong></p>
<h4 style="text-align:center;" class="text-danger" >'. $row['product_price'] .'</h4>
if($row["rating"]==1)
{
<span class="fa fa-star checked"></span>
<span class="fa fa-star"></span>
<span class="fa fa-star"></span>
<span class="fa fa-star"></span>
<span class="fa fa-star"></span>
}
if($row["rating"]==2)
{
<span class="fa fa-star checked"></span>
<span class="fa fa-star checked"></span>
<span class="fa fa-star"></span>
<span class="fa fa-star"></span>
<span class="fa fa-star"></span>
}
</div>
</div>
';
}
}
else
{
$output = '<h3>No Data Found</h3>';
}
echo $output;
}
?>