I can't figure out what is wrong with this: $query = "select count(*) as monthly_views from visitors group by extract('year', time), extract('month', time) order by monthly_view desc limit 1"; $result = mysql_query($query); echo $query; $row = mysql_fetch_array($result); echo $row['monthly_views']; echo mysql_error();
I get this: select count(*) as monthly_views from visitors group by extract('year', time), extract('month', time) order by monthly_view desc limit 1 Warning: Supplied argument is not a valid MySQL result resource in C:\Inetpub\TecEco_PHP\stats_interface\summary.php on line 76 You have an error in your SQL syntax near ''year', time), extract('month', time) order by monthly_view desc limit 1' at line 1 I don't know any advanced SQL so I don't know how to debug this. I am using mySQL. The person who gave me this code appeared to be using postgreSQL if that makes any differance -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php