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())"; Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.