請幫我看一下SQL_error.log的資料
19-01-2006 17:15:44 ERROR - The following query =
SELECT COUNT(*) as t, SUM((num_reads / (TO_DAYS(NOW()) - TO_DAYS(a.date) 1)) ) as rank, b.*
FROM plog_articles AS a
INNER JOIN plog_blogs AS b
ON b.id=a.blog_id AND b.status=1 WHERE a.date >= 20060112171544 AND a.date <= 20060119171544
GROUP BY a.blog_id ORDER BY rank DESC LIMIT 0,30
generated the following error message =
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1)) ) as rank, b.*
FROM plog_articles AS a
' at line 1
我真的建議你,下次如果不確定請不要亂改核心程式。如果你還是執意要改要練習,那我很支持,但是至少先備份一下你改之前的檔案,這樣發生錯誤能回復。
這個錯誤
『我猜』是因為你把 sql 裡面的
+ 給去掉了。
原來的:
function getMostActiveBlogs( $maxBlogs = 0 )
{
$prefix = $this->getPrefix();
$query = "SELECT COUNT(*) as t, SUM((num_reads / (TO_DAYS(NOW()) - TO_DAYS(a.date) + 1)) ) as rank, b.*
下面是你的
(我猜的):
function getMostActiveBlogs( $maxBlogs = 0 )
{
$prefix = $this->getPrefix();
$query = "SELECT COUNT(*) as t, SUM((num_reads / (TO_DAYS(NOW()) - TO_DAYS(a.date) 1)) ) as rank, b.*
我要你看哪一文章,不知道你是否有看?裡面有說除了 error.log 外,還要把改過的
程式、模版 附上來,這樣才有辦法來幫你除錯。
如果你可以一開始把這些資料準備齊全,那就不用來來回回好幾遍!下次請務必記得。
Mark