timmah1 Posted January 19, 2009 Share Posted January 19, 2009 This code limits itself to 10 results. I need to pull all of the temperatures from the database, the are listed like 96.5, 97.3, 98.9 and so on. When I run the query, it only shows 10 results. Can anybody tell me why it does this? <?php $month = date("m"); $query = "SELECT * FROM charts WHERE username = 'admin' AND MONTH(posted) = '$month' ORDER BY DAY(posted)"; $chart = mysql_query($query); while($charts = mysql_fetch_assoc($chart)){ $temps[$charts['temp']] = $charts['temp']; } $temp = implode(',', $temps); echo $temp."<br />"; ?> Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/141509-query-limiting-results/ Share on other sites More sharing options...
Philip Posted January 19, 2009 Share Posted January 19, 2009 What data is in the database? Quote Link to comment https://forums.phpfreaks.com/topic/141509-query-limiting-results/#findComment-740726 Share on other sites More sharing options...
revraz Posted January 19, 2009 Share Posted January 19, 2009 There is nothing there limiting to 10 results. But should $temps[$charts['temp']] be $temps[$charts][['temp'] ? Not really sure what you are trying to do there. Quote Link to comment https://forums.phpfreaks.com/topic/141509-query-limiting-results/#findComment-740728 Share on other sites More sharing options...
timmah1 Posted January 19, 2009 Author Share Posted January 19, 2009 There are 23 items in the database, but it is only echoing out 10 results posted = date field temp = varchar field and username Quote Link to comment https://forums.phpfreaks.com/topic/141509-query-limiting-results/#findComment-740730 Share on other sites More sharing options...
timmah1 Posted January 19, 2009 Author Share Posted January 19, 2009 Not sure what you mean by this revraz $temps[$charts][['temp'] ? Quote Link to comment https://forums.phpfreaks.com/topic/141509-query-limiting-results/#findComment-740732 Share on other sites More sharing options...
revraz Posted January 19, 2009 Share Posted January 19, 2009 What are you trying to do here? $temps[$charts['temp']] Quote Link to comment https://forums.phpfreaks.com/topic/141509-query-limiting-results/#findComment-740739 Share on other sites More sharing options...
timmah1 Posted January 19, 2009 Author Share Posted January 19, 2009 I got it fixed, I have no idea what the hell I was doing I took this $temps[$charts['temp']] = $charts['temp']; and changed it to this $temps[] = $charts['temp']; and it works perfect Thanks for opening my eyes revraz Quote Link to comment https://forums.phpfreaks.com/topic/141509-query-limiting-results/#findComment-740744 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.