So after switching servers I go to my topics module and all i see is this poorly written message
Quote:
...There aren't any news yet for this topic...
But really there "are news". So what it boiled down to is changing the query to work in this newer version of MySQL. Apparently "reads" is a reserved word now??
Old, Broken Version:
Code:
$sql = "SELECT t.topicid, t.topicimage, t.topictext, count(s.sid) AS stories, SUM(s.counter) AS reads FROM ".$prefix."_topics t LEFT JOIN ".$prefix."_stories s ON (s.topic = t.topicid) GROUP BY t.topicid, t.topicimage, t.topictext ORDER BY t.topictext";
I found by simply changing "reads" to something else fixed the problem.
Changed the above to:
Code:
$sql = "SELECT t.topicid, t.topicimage, t.topictext, count(s.sid) AS stories, SUM(s.counter) AS views FROM ".$prefix."_topics t LEFT JOIN ".$prefix."_stories s ON (s.topic = t.topicid) GROUP BY t.topicid, t.topicimage, t.topictext ORDER BY t.topictext";
Joined: Aug 29, 2004 Posts: 7236 Location: Arizona
Posted:
Wed Feb 14, 2007 8:38 pm
gotcha, thanks for this. Just so the RavenNuke crowd knows, this is NOT an issue with that release because RavenNuke uses an enhanced Topics module. It does not have that issue.
Joined: Apr 06, 2006 Posts: 2355 Location: Iowa, USA
Posted:
Sun Sep 02, 2007 10:17 am
I know this is old but in case anyone searches for this problem...
I think a simpler fix would be to put back ticks around reads in the SQL. I think that will tell MySQL not to confuse it with the new reserved word called READS.
For example:
Code:
$sql = "SELECT t.topicid, t.topicimage, t.topictext, count(s.sid) AS stories, SUM(s.counter) AS `reads` FROM ".$prefix."_topics t LEFT JOIN ".$prefix."_stories s ON (s.topic = t.topicid) GROUP BY t.topicid, t.topicimage, t.topictext ORDER BY t.topictext";
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum