Forum Moderators: coopster
Just wandering if someone could point out the mistake, thanks.
While executing query "SELECT t.topicid, t.topicimage, t.topictext, count(s.sid) AS stories, SUM(s.counter) AS reads FROM cms_topics t LEFT JOIN cms_stories s ON (s.topic = t.topicid) GROUP BY t.topicid, t.topicimage, t.topictext ORDER BY t.topictext"
the following error occured: You have an error in your SQL syntax; check the right syntax to use near 'reads FROM cms_topics t LEFT JOIN cms_stories s ON (s.topic = t In: /******************/modules/Topics/index.php on line: 22
Thanks in advance
Thanks for your quick reply. I have tried the following but still getting an error.
$result = $db->sql_query('SELECT t.topicid, t.topicimage, t.topictext, count(s.sid) AS stories, SUM(s.counter) AS reads
FROM '.$prefix.'_topics t, '.$prefix.'_stories s WHERE s.topic = t.topicid
GROUP BY t.topicid, t.topicimage, t.topictext ORDER BY t.topictext',false, __FILE__, __LINE__);
/* and */
$result2 = $db->sql_query('SELECT s.sid, s.catid, s.title, c.title AS cat_title FROM '.$prefix.'_stories s, '.$prefix."_stories_cat c WHERE s.catid=c.catid
WHERE s.topic='$topicid' ORDER BY s.sid DESC LIMIT 0,10",false, __FILE__, __LINE__);
/* Error Msg */
CMS Warning line 51: On /index.php?name=Topics While executing query "SELECT t.topicid, t.topicimage, t.topictext, count(s.sid) AS stories, SUM(s.counter) AS reads FROM cms_topics t, cms_stories s WHERE s.topic = t.topicid GROUP BY t.topicid, t.topicimage, t.topictext ORDER BY t.topictext" the following error occured: 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 'reads FROM cms_topics t, cms_stories s WHERE s.topic = t.topici In: /******/modules/Topics/index.php on line: 22
Have I mis-understood what you were suggesting?