Apartments and houses currently for sale in Greenwich between £400,000 and £499,999..
0 AND price>=400000 AND price<499999) ORDER BY price desc";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
//property block
echo “
echo ““;
if (strpos($row[“status”], ‘rent’) !== false) {echo “£” . $row[‘price’]. ” pcm“;}
else
{echo “£” . number_format($row[‘price’]). ““;}
if ($row[‘price_modifier’]!=””) {echo ” (“. str_replace(“_”, ” “, $row[‘price_modifier’]). “)“;}
echo “
“;
if (strpos($row[“status”], ‘rent’) !== false) {echo “To Rent
“;}
else
{echo “For Sale
“;}
$myaddress = “”;
if ($row[‘street_name’]!=””) {$myaddress = $row[‘street_name’];}
else
{$myaddress = $row[‘displayable_address’];}
if ($myaddress=”London”) {$myaddress = $row[‘displayable_address’];}
$myaddress = str_replace(“London”,””,$myaddress);
$myaddress = str_replace(“SE10″,””,$myaddress);
$myaddress = str_replace(“Greenwich”,””,$myaddress);
$myaddress = str_replace(“,”,” “,$myaddress);
$myaddress = str_replace(” “,” “,$myaddress);
echo “” . $myaddress. ““;
if ($row[‘num_bedrooms’]>0)
{echo “ “;}
echo “
” . $row[“agent_name”]. ““;
echo “
Online since ” . date(‘F j’,strtotime($row[‘first_published_date’])). ““;
echo “
“;
}
} else {
echo “We currently have no properties to show :-(“;
}
$conn->close();
?>