PHP gods, after a bit of help

Soldato
Joined
18 Oct 2002
Posts
7,614
Location
Sutton Coldfield, Birmingham
I have a table with properties. By default I want to show properties by certain category but i'd also like the ability to limit the results based on min and max price, min and max bed, area and keywords.

Now I can select by catID easily enough but it's handling the other stuff when dealing with a PDO prepared statement.

In my head I realise i'm going to have to use arrays but it's getting those arrays into the statement that i'm finding difficult.

For example, say I have the following options on the form:-

areas
Code:
area 1
area 2
area 3
area 4

keywrods
Code:
garage
garden
heating

and I want to see whether the area is named out of 5 fields in the table. The addresses are laid out like

number / address1 / address2 / address3 / address4 / postcode

Now i've used LIKE before but it's the whole looping through the options thing which confuses me.

The current query is simple and I want to convert this into a prepared statement

PHP:
$q = $db->query("SELECT * FROM props WHERE property_visible = '1' $catid ORDER BY $orderby $limit");

if a specific catID is required then catid is
PHP:
WHERE catid = '1'

Any ideas, suggestions?
 
Back
Top Bottom