Problem with SQL query

From: Date: Sun, 07 Jul 2002 09:37:46 +0000
Subject: Problem with SQL query
Groups: php.general 
Request: Send a blank email to php-general+get-105940@lists.php.net to get a copy of this message
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 webmaster@tececo.com www.tececo.com

« previous php.general (#105940) next »