i just realized that the dates in the database are saved as varchar (althought they are numbers) is there anyway to compare the $lastmonth value (which returns as a 14 digit number) to that because the way i have it now with > post_date <= '$lastmonth' wont work because post_date is varchar and $lastmonth is an interger right? "Matthew" <speakez@xxxxxxxxxxxxxxxxx> wrote in message news:20041007181505.27391.qmail@xxxxxxxxxxxxxxx > Hi guys im pretty new at this and cant seem to get this going.... I want the > code to query the database for the number of messages posted within the last > month this is the code i have but its not working... I might even have it > all wrong, can someone point me in the right direction? > > $lastmonth = date("YmdHis", mktime(date("H"), date("i"), date("s"), > date("m")-1, date("d"), date("Y"))); > $countResult = db_query("SELECT count(*) AS msgCount FROM messages WHERE > uid = '". $userID ."' AND fid = '". $fid ."' AND post_date <= '". $lastmonth > ."'"); > $countRow = db_fetch_array($countResult); > > im then using $countRow as my variable but it keeps returning a value of > zero. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php