alexviii 0 Report post Posted November 5, 2006 Ok so I have an array that I would like to group by date. When I use the group by in a mysql query it only shows one record with that value. However I want to show all the records grouped by date. This is what I have so far. $completedprojectsresults=mysql_query("SELECT request_tbl.*, DATE_FORMAT(SubmittalDate, '%b %d, %Y') cdate , s.* FROM request_tbl , site_tbl AS s WHERE request_tbl.Site_ID = s.Site_ID AND request_tbl.Date_Completed >= STR_TO_DATE('$from', '%m-%d-%Y') AND request_tbl.Date_Completed <= STR_TO_DATE('$to', '%m-%d-%Y') Group BY request_tbl.Request_ID ORDER BY cdate, s.FullSiteName"); while($cprow=mysql_fetch_assoc($completedprojectsresults)){ echo "<dl>"; echo "Completed on "; echo $cprow['cdate']; echo "<li>"; echo $cprow['SiteLookup']; echo "</li></dl>"; } 10x Share this post Link to post Share on other sites
beeseven 0 Report post Posted November 6, 2006 Why don't you put everything into an array? Actually....You could choose some random date before the while loop and assign it to a variable, say $date. At the beginning of the loop, check if the date of the next project is the same as $date. If it is, just display the project name. If it isn't, display the new date and change $date to the new date. Share this post Link to post Share on other sites