Page 1 of 1

** solved ***Search using selection items

Posted: Mon Nov 28, 2005 1:13 pm
by mhouldridge
Hi,

I am trying to carry out a search using selection items put into an array. I am not sure that this is the best way to do this, however I think it could work.

I have the following code;

Code: Select all

$array [0]= $location;
$array [1]=$bedrooms;
$array [2]=$type;
$array [3]=$price;

echo $array[0];

// Query database with search variables	
$result = mysql_query("SELECT * FROM homes WHERE location LIKE '%$array[0]%'");
Please help.

Posted: Mon Nov 28, 2005 1:38 pm
by mhouldridge
Here is my query... It doesnt seem to give me a result from my selection boxes;

Code: Select all

$result = mysql_query("SELECT * FROM location, bedrooms, type, price WHERE location = '$array[0]' AND bedrooms = '$array[1]' AND type='$array[2]' AND price '$array[3]'");

Posted: Mon Nov 28, 2005 2:13 pm
by mhouldridge
got it working now.