sstangle73 Posted August 23, 2007 Share Posted August 23, 2007 $query="SELECT * FROM users where id = 0-20 $query="SELECT * FROM users where id = 21-40 i want it to do that but im not sure of the correct code can someone tell me please Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted August 23, 2007 Share Posted August 23, 2007 maybe something like this: <?php if ($id <= 20) { $id="something"; } else { $id="something2"; } $query="SELECT * FROM users where id='$id'" ?> Quote Link to comment Share on other sites More sharing options...
keeB Posted August 23, 2007 Share Posted August 23, 2007 <?php $query="SELECT * FROM users where id >= 0 and id <= 20" $q2 = "$query="SELECT * FROM users where id >= 21 and <= 40" ?> Quote Link to comment Share on other sites More sharing options...
Barand Posted August 23, 2007 Share Posted August 23, 2007 or $query="SELECT * FROM users where id BETWEEN 21 AND 40 Quote Link to comment Share on other sites More sharing options...
beboo002 Posted August 23, 2007 Share Posted August 23, 2007 select * from abhi where name =>5 and name <=10 ; use this code insted of $query="SELECT * FROM users where id = 0-20 Quote Link to comment Share on other sites More sharing options...
keeB Posted August 24, 2007 Share Posted August 24, 2007 or $query="SELECT * FROM users where id BETWEEN 21 AND 40 Learn something new every day, didn't know about the BETWEEN keyword. Thanks B! Quote Link to comment Share on other sites More sharing options...
sstangle73 Posted August 24, 2007 Author Share Posted August 24, 2007 yeah thats a nice feature to know thanks b thats the one i tried and it worked Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.