Jump to content


Photo

Mysql Help


  • Please log in to reply
1 reply to this topic

#1 mjm037

mjm037
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 03 April 2006 - 12:52 PM

Hey, have a quick problem. am trying to select rows from a database where the quantity is between 0 and 10 (but not 0).

can get less than 11:

$sql = "SELECT * FROM myTable WHERE Quantity <= 11;"

or more than 0:

$sql = "SELECT * FROM myTable WHERE Quantity > 0;"

but dont know the syntax for both at the same time, please help!!



#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 03 April 2006 - 01:23 PM

$sql = "SELECT * FROM myTable WHERE Quantity BETWEEN 1 AND 11



That should work :) but the column `Quantity` HAS to be set as INT in the database! else it will treat it just like a word instead of a number :)

Regards
Liam
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users