in reply to hmm MySQL not printing write
May I suggest that instead of using columns named month, day, hour and min you just have a single column called timestamp (which is updated automagically on writes thus saving all but the last two lines of code)
T
I
M
T
O
W
T
D
I