Catp00p Posted October 18, 2003 Share Posted October 18, 2003 I have tried this but it is returning value of 0... postdate is a datetime field and there are many records in the current month. $query2 = "SELECT count(*) FROM news WHERE author = \'$newsPosterName\' AND posttime = MONTH(NOW())"; Link to comment https://forums.phpfreaks.com/topic/1179-how-do-i-query-a-datetime-for-the-current-month/ Share on other sites More sharing options...
Barand Posted October 18, 2003 Share Posted October 18, 2003 Almost [php:1:135268d700]<?php $query2 = \"SELECT count(*) FROM news WHERE author = \'$newsPosterName\' AND MONTH(posttime) = MONTH(NOW())\"; ?>[/php:1:135268d700] hth EDIT : PS you might want to check the years are the same too Link to comment https://forums.phpfreaks.com/topic/1179-how-do-i-query-a-datetime-for-the-current-month/#findComment-3964 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.