MySQL will not invent rows for you, so if there is no data, they will naturally not be displayed.
You can create a calendar table and join it,
create table calendar ( day date primary key, );
Fill this table with dates (easily using a stored procedure or just some common scripts), until 2038, and something else is likely to break unitl, which will become a problem.
Then your request becomes, for example,
SELECT logTime, COUNT(*) FROM calendar cal left join logs l on cal.day = l.logTime WHERE day >= '2011-02-01' AND day <= '2011-02-04' GROUP BY day;
Now you can expand the calendar table to other columns that indicate the month, year, week, etc., so that you can easily create statistics for other units of time. (and purists might argue that the calendar table has an integer primary key identifier that refers to a table of log tables instead of a date)
source share