Skip to main content
Inspiring
October 22, 2006
Question

SQL Query to workout values between two prices

  • October 22, 2006
  • 15 replies
  • 937 views
Hi all,
I'm making an application to create a search page that has a drop down box with prices such as:

£100-£1000
£2000-£4000
etc..

How does this work?

This topic is closed to new replies. Start a new post to keep the conversation going.

15 replies

Inspiring
October 22, 2006
Thanks, all is working well.
Inspiring
October 23, 2006
The SQL statement I was using was working fine lastnite but has now stopped working.

I cannot get any values to be returned once I put the search thru.

Can anyone help? I've tried to post this as a new message but the site kept telling me that this page does not exsist.

SELECT PropID, Address, Area, Postcode,PropType, Description, NoBeds, Garden, Lrg_Image, Image2, Cost
FROM property
WHERE Area = '$Area' AND PropType = '$PropType' AND NoBeds = '$beds' AND Garden = '$garden' AND Accepted = 'Yes' AND Postcode LIKE '%$postcode%' AND Cost >= '$cost'
ORDER BY PropID DESC
Inspiring
October 22, 2006
The_FedEx_Guy wrote:
> Hi all,
> I'm making an application to create a search page that has a drop down box with prices such as:
>
> ?100-?1000
> ?2000-?4000
> etc..

SELECT * FROM products
WHERE price >= 100
AND price <= 1000

Use variables to change the values according to what is selected from
the drop-down.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Inspiring
October 22, 2006
Hi how about say if I wanted to select the first part of a postcode

example: WS9 from the database, that holds WS9 9PP?