shanejeffery86 Posted August 3, 2009 Share Posted August 3, 2009 NOTE: I did try the solution at the top of the forum, but could not get it to work. Hey all. My query is as follows: SELECT acc_id, class, race, gender, current_level, pic_url, server, short_desc, featured, price FROM outbound_acc WHERE current_status='0' ORDER BY RAND() LIMIT 3 Now what is happening is that the query sometimes returns 3 results and sometimes returns 2 results. It will never just continuously return 3. What am I doing wrong? I have a feeling that it has something to do with the interaction of the LIMIT and RANDOM setup. Any help would be appreciated. Link to comment https://forums.phpfreaks.com/topic/168657-limit-random-issue-with-return-results/ Share on other sites More sharing options...
gevans Posted August 3, 2009 Share Posted August 3, 2009 <ay seem like a dumb question, but how many rows do you have in your table? Link to comment https://forums.phpfreaks.com/topic/168657-limit-random-issue-with-return-results/#findComment-889699 Share on other sites More sharing options...
shanejeffery86 Posted August 3, 2009 Author Share Posted August 3, 2009 5 rows at the moment. Could the odd count be the issue? Link to comment https://forums.phpfreaks.com/topic/168657-limit-random-issue-with-return-results/#findComment-889707 Share on other sites More sharing options...
gevans Posted August 3, 2009 Share Posted August 3, 2009 How many of the rows have current_status set to 0? Link to comment https://forums.phpfreaks.com/topic/168657-limit-random-issue-with-return-results/#findComment-889709 Share on other sites More sharing options...
shanejeffery86 Posted August 3, 2009 Author Share Posted August 3, 2009 All of them. I just added additional rows. There are now 10 with the current_status set to 0. Still the same issue. Link to comment https://forums.phpfreaks.com/topic/168657-limit-random-issue-with-return-results/#findComment-889711 Share on other sites More sharing options...
gevans Posted August 3, 2009 Share Posted August 3, 2009 well, they were my quick questions, ill get back to you if i can think of anything else that might be causing it. sounds very strange! Link to comment https://forums.phpfreaks.com/topic/168657-limit-random-issue-with-return-results/#findComment-889715 Share on other sites More sharing options...
shanejeffery86 Posted August 3, 2009 Author Share Posted August 3, 2009 I could always pull all of the results and then with PHP just do a for loop with the increment of 2 (counting starts at zero) and just do it that way. Link to comment https://forums.phpfreaks.com/topic/168657-limit-random-issue-with-return-results/#findComment-889720 Share on other sites More sharing options...
gevans Posted August 3, 2009 Share Posted August 3, 2009 If you ask about this post http://www.phpfreaks.com/forums/index.php/topic,125759.0.html you may get away of doing it with a certain number of rows, can't figure it out of the top of my head, and don't have time to test it myself Link to comment https://forums.phpfreaks.com/topic/168657-limit-random-issue-with-return-results/#findComment-889734 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.