Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 05-12-04
Registered User
 
Join Date: Aug 2003
Location: Cornwall
Posts: 209
Thanks: 0
Thanked 0 Times in 0 Posts
Melter is an unknown quantity at this point
  Mysql search query

I'm trying to do a page of items between set prices and I either get an error or the search returns every item. This is what I've tried
Quote:
SELECT * FROM store WHERE searchPrice => 50 OR searchPrice <= 100 ORDER BY searchPrice ASC
Where am I going wrong?
__________________
Lcd Tv Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-12-04
Super Moderator
 
Join Date: Aug 2003
Posts: 2,451
Thanks: 0
Thanked 0 Times in 0 Posts
Rich is an unknown quantity at this point
Just change the OR to AND and it should work fine.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-12-04
999gi's Avatar
aka Antony
 
Join Date: Aug 2003
Location: Bristol
Posts: 971
Thanks: 0
Thanked 0 Times in 0 Posts
999gi is an unknown quantity at this point
Dont know if it matters but I always use >= rather than =>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-12-04
Registered User
 
Join Date: Aug 2003
Location: Cornwall
Posts: 209
Thanks: 0
Thanked 0 Times in 0 Posts
Melter is an unknown quantity at this point
Okay tried that and I'm still getting syntax errors.

This works
Quote:
SELECT * FROM store WHERE searchPrice <= 10 ORDER BY searchPrice ASC
And this doesn't
Quote:
SELECT * FROM store WHERE searchPrice >= 50 AND <= 100 ORDER BY searchPrice ASC
__________________
Lcd Tv Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #5 (permalink)  
Old 05-12-04
Registered User
 
Join Date: Jun 2004
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
amcd78 is an unknown quantity at this point
Sorry, did you say this doesn't work?

SELECT * FROM store WHERE searchPrice >= 50 AND searchPrice <= 100 ORDER BY searchPrice ASC
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 05-12-04
Registered User
 
Join Date: Aug 2003
Location: Cornwall
Posts: 209
Thanks: 0
Thanked 0 Times in 0 Posts
Melter is an unknown quantity at this point
Doh! I'd taken out the second searchPrice. That's done the trick. Cheers guys.
__________________
Lcd Tv Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 05-12-04
ianm's Avatar
Avoiding real work
 
Join Date: Aug 2003
Location: Buckinghamshire
Posts: 1,382
Thanks: 0
Thanked 0 Times in 0 Posts
ianm is an unknown quantity at this point
You're missing the field name in the second comparison -

Code:
SELECT * FROM store WHERE searchPrice >= 50 AND <= 100 ORDER BY searchPrice ASC
Should be

Code:
SELECT * FROM store WHERE searchPrice >= 50 AND searchPrice <= 100 ORDER BY searchPrice ASC
__________________
Those who can do, those who can't talk about it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #8 (permalink)  
Old 05-12-04
Registered User
 
Join Date: Mar 2004
Location: UK
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
MikkyX is an unknown quantity at this point
You could also use:

Code:
SELECT * FROM store WHERE searchPrice BETWEEN 50 AND 100 ORDER BY searchPrice ASC
It's something like that anyway.
__________________
Michael Price
http://www.cyberscore.net/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7