> 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. $countRow is returning 0 or empty? What does print_r($countRow) show you? Also, try running your query from the mysql prompt, substituting the PHP with real values. See if mysql complains about your query. -- --Matthew Sims --<http://killermookie.org> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php