Page 1 of 1
PHP, MySQL query problem with syntax
Posted: Mon May 28, 2012 9:26 pm
by me!
it all works except the
WHERE asking_price >= '10.00'
Code: Select all
$sql = "SELECT * FROM equipment WHERE asking_price >= '10.00' AND sold_for = '0.00' AND sold_to = '' ORDER BY asking_price DESC LIMIT 3";
So what did I screw up?
Re: PHP, MySQL query problem with syntax
Posted: Mon May 28, 2012 10:25 pm
by Christopher
What type of field is asking_price? If it is not a CHAR/VARCHAR then it should be "asking_price >= 10.0"
Re: PHP, MySQL query problem with syntax
Posted: Mon May 28, 2012 10:54 pm
by me!
asking_price and sold_for are decimal(11,2)
Re: PHP, MySQL query problem with syntax
Posted: Mon May 28, 2012 11:11 pm
by me!
changed it to this but it still is not doing asking_price correct.
Code: Select all
$sql = "SELECT * FROM equipment WHERE asking_price >= 10.00 AND sold_for = 0.00 AND sold_to = '' ORDER BY asking_price DESC LIMIT 3";
Re: PHP, MySQL query problem with syntax
Posted: Mon May 28, 2012 11:20 pm
by me!
Ah! now I see my problem... "LIMIT 3" oops!