What a confusing thread to follow!
Your first query is a group by - which is what you're after and you get the counts without any other data
the second query has no group by on it - its just pulling all rows and concatting a var from the last loop which is either not set or is the last value in the last loop.
just add the fields you want to the group by - don't pull time as time will be false(it will be a random time entry from one of the rows in the group)
$resultday = mysql_query("SELECT waktu, date, COUNT(idads) AS countidadsday FROM adsmgt GROUP BY date") or die(mysql_error());
echo "waktu,date,count<br/>\r\n";
while($row = mysql_fetch_assoc($result)){
echo "{$row['waktu']},{$row['date']},{$row['countidadsday']}<br/>\r\n";
}
If you want the data into an array for random use you can output it into an array with the date as the key - i find it useful for when you are dynamically pulling data and not sure which data will be shown as the data shown is also dynamic.
$resultday = mysql_query("SELECT waktu, date, COUNT(idads) AS countidadsday FROM adsmgt GROUP BY date") or die(mysql_error());
$clicksByDay = array();
while($row = mysql_fetch_assoc($result)){
$clicksByDay[$row['date']] = $row;
}
echo $clicksByDay['2013-01-17'];
Edit:
Oh and you can use date() to turn into a date or substr() to turn a datetime field into a year,month,day,hour or minute
select date(`date`) FROM...
SELECT SUBSTR(`date`,1,10) as `date`,SUBSTR(`date`,1,7) as `month`,SUBSTR(`date`,1,13) as `hour` FROM...
Remember using a function is much slower than using an indexed field, you'll want to make a separate field and index it on large tables