You can use a single SQL statement to acheive your goal of counting the results by day.
SELECT DATE_FORMAT(time, '%Y %m %d'), COUNT(*)
FROM resultat
WHERE user = $user
AND kontroll = 'ok!'
AND time BETWEEN $start AND $end
GROUP BY DATE_FORMAT(time, '%Y %m %d')
I can't figure out what your 'week' variable is attempting to do, but it will be easier to achieve using the highly sophisticated options of the DATE_FORMAT function.
In my example, by the way, you can also change the SELECTed DATE_FORMAT to display in one format, and the GROUP BY DATE_FORMAT to create counting using another format.