Jump to content


Photo

search by price


  • Please log in to reply
1 reply to this topic

#1 john_tripod

john_tripod
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 27 May 2006 - 11:58 AM

I've got a field in my database of car prices. I want to be able to search them from a drop down menu of price fields like £1000-£3000. How do I write the PHP for the form and the handler? Cheers

John

#2 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 27 May 2006 - 12:19 PM

[!--quoteo(post=377535:date=May 27 2006, 09:58 PM:name=john_tripod)--][div class=\'quotetop\']QUOTE(john_tripod @ May 27 2006, 09:58 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I've got a field in my database of car prices. I want to be able to search them from a drop down menu of price fields like £1000-£3000. How do I write the PHP for the form and the handler? Cheers

John
[/quote]

you can use query like this:

select * from cartable where price >= 1000 and price <= 3000;
or
select * from cartable where price between 1000 and 3000;

either of that would work, but prefer the first one.

Life's too short for arguing.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users