Jump to content

Archived

This topic is now archived and is closed to further replies.

Brendan

operators

Recommended Posts

How would i go about searching a mysql database for a value greater than one number and less than or equal to another, and visa versa?

For Example
if ($price=="3") {$op.="(price>61.00 && price<=100.99)";}    

This doesnt work of course, but perhaps it will give an idea of what im trying to achieve.

Thanks,
-Brendan


Share this post


Link to post
Share on other sites
$p1 = 61.00;
$p2 = 100.99;

... WHERE price > $p1 AND price <= $p2

or

$p1 = 61.01;
$p2 = 100.99;

... WHERE price BETWEEN $p1 AND $p2

Share this post


Link to post
Share on other sites
where category='1' AND price>'61.00' AND price<='100.99' ORDER BY prod DESC

I've tried that, but this doesn't seem to work.

Share this post


Link to post
Share on other sites
Define doesn't work.

Query gives an error or you don't get the results you expect?

Share this post


Link to post
Share on other sites
[quote author=thorpe link=topic=104108.msg426272#msg426272 date=1157152475]
What field types are you using?
[/quote]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.