PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
gotcha
Regular
Regular


Joined: Mar 14, 2005
Posts: 88

PostPosted: Wed Feb 14, 2007 8:20 pm Reply with quote Back to top

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";


Changed:
Code:
$output .= "<big><strong>&middot;</strong></big> <b>"._TOTREADS.":</b> ".(isset($row['reads']) ? $row['reads'] : 0)."</font>";


To:
Code:
$output .= "<big><strong>&middot;</strong></big> <b>"._TOTREADS.":</b> ".(isset($row['views']) ? $row['views'] : 0)."</font>";


And the topics module was back to normal.
View user's profile Send private message Visit poster's website
montego
Moderator


Joined: Aug 29, 2004
Posts: 7582
Location: Arizona

PostPosted: Wed Feb 14, 2007 8:38 pm Reply with quote Back to top

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.
View user's profile Send private message Visit poster's website
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2401
Location: Iowa, USA

PostPosted: Sun Sep 02, 2007 10:17 am Reply with quote Back to top

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 user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2008 by Raven
Proud to be listed at Lobo Links Web Directory

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::

:: fisubice Theme Recoded To 100% W3C CSS & HTML 4.01 Transitional Compliance by Raven and 64bitguy ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum