Jump to content

displaying results from a mysql database


ianhaney

Recommended Posts

Hi

 

I have got results being displayed after clicking the search button in a form on my home page but it brings up all the results which is ok but how do I get onlt the results a user searches for for example a location or property type etc as its for a property website

 

The coding is below for the results page

 

Also sorry how do I add a background image to the php page, I tried using css but wouldn't work

 

<style type="text/css">
body {background-image:url('images/greybgone.png');}
</style>

<?php

mysql_connect ("2up2downhomes.com.mysql", "2up2downhomes_c","mD8GsJKQ")  or die (mysql_error());
mysql_select_db ("2up2downhomes_c");

echo $_POST['term'];

$sql = mysql_query("select * from properties where typeProperty like '%$term%' or location like '%$term%'");

while ($row = mysql_fetch_array($sql)){
    echo 'Type of Property: '.$row['typeProperty'];
    echo '<br/> Number of Bedrooms: '.$row['bedrooms'];
    echo '<br/> Number of Bathrooms: '.$row['bathrooms'];
echo '<br/> Garden: '.$row['garden'];
echo '<br/> Description: '.$row['description'];
echo '<br/> Price: '.$row['price'];
echo '<br/> Location: '.$row['location'];
echo '<br/> Image: '.$row['image'];
    echo '<br/><br/>';
    }

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.