//my php code that connects to database
<?php
$output = NULL;
if(isset($_POST['submit'])){
$search = $link->real_escape_string($_POST['search']);
//Query the database
$resultSet = $link->query("SELECT * FROM members WHERE city LIKE '$search%'");
if($resultSet->num_rows > 0){
while($rows = $resultSet->fetch_assoc())
{
$fname = $rows['firstname'];
$lname = $rows['lastname'];
$city = $rows['city'];
$price = $rows['price'];
$img = $rows['img'];
$output = " $city ";
}
} else{
$output = "no results";
}
}
?>
// DIv where i want to display the results dynamically
<ul class="products">
<li >
<a href="#" >
<img width="450" height="450" src="<?php echo $img; ?>" alt="Dancing between Red Mountain" title="nature-person-red-woman" />
<h3><?php echo $fname ." ". $lname; ?></h3> <span class="price"><span >
<span >£</span><?php echo $price; ?></span>
</span>
</a>
</li>
</ul>