I have a problem outputting the following mysql statement. What I'd like to do with it is show how many values have the same date. 07/10/2010 - 2 06/10/2010 - 10 Code (markup): My view_date entries in the database look like this 1286454350, 1286454350, 1286454350, 1286363232, 1286363232, 1286363232, 1286363232, 1286479111 Code (markup): $q=mysql_query("SELECT DATE_FORMAT(FROM_UNIXTIME(view_date), '%m-%d-%Y') AS sdate, COUNT(id) AS scount FROM $tbl WHERE view_date <= UNIX_TIMESTAMP(NOW()) AND view_date UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 30 DAY)) GROUP BY sdate"); PHP: Thanks In Advanced.
You can get the values from database ( $q = mysql_query("SELECT `view_date` FROM $tbl"); ) and count the view_date by PHP script. I think this script example will help you to do it: function convert_dates(&$value){ $value = date("d/m/Y",$value); } $dates = array(1286454350, 1286454350, 1286454350, 1286363232, 1286363232, 1286363232, 1286363232, 1286479111); array_walk($dates,"convert_dates"); print_r(array_count_values($dates)); PHP: