iStriide Posted August 6, 2011 Share Posted August 6, 2011 I'm not sure on how to do this so I hope one of you can help me. I'm trying to do a mysql_query(); function in PHP to get certain results. I'm trying to get users from my database where their ID's are between 1 and 100. So what would I have to do for that? Quote Link to comment https://forums.phpfreaks.com/topic/244069-mysql_query-function-help/ Share on other sites More sharing options...
AyKay47 Posted August 6, 2011 Share Posted August 6, 2011 I would use the mysql BETWEEN() function here...it would be easier to help if you posted your code... Quote Link to comment https://forums.phpfreaks.com/topic/244069-mysql_query-function-help/#findComment-1253439 Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 Hi There, Maybe I can be some sort of assistance to you here. MySQL offers a variety of tools within its query segments in order to provide you different ways of pulling out a certain set of results, its truly a language of its own once you get down to it. Here's a prime example of what I mean related to your question: mysql_query("SELECT * FROM `users` WHERE `user_id` > 1 AND `user_id` < 100"); Quote Link to comment https://forums.phpfreaks.com/topic/244069-mysql_query-function-help/#findComment-1253440 Share on other sites More sharing options...
iStriide Posted August 6, 2011 Author Share Posted August 6, 2011 Hi There, Maybe I can be some sort of assistance to you here. MySQL offers a variety of tools within its query segments in order to provide you different ways of pulling out a certain set of results, its truly a language of its own once you get down to it. Here's a prime example of what I mean related to your question: mysql_query("SELECT * FROM `users` WHERE `user_id` > 1 AND `user_id` < 100"); You help me once again. Quote Link to comment https://forums.phpfreaks.com/topic/244069-mysql_query-function-help/#findComment-1253443 Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 My pleasure to help you, it is note worthy to also look into the solution AyKay7 provided, there may be a performance difference here. Mark Topic As Solved. - Sensei Quote Link to comment https://forums.phpfreaks.com/topic/244069-mysql_query-function-help/#findComment-1253445 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.