Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 21st, 2005, 10:59 AM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with book code of Chapter 16

I am running the code of Chapter 16. However, the following problem occurs in index.php after entering the login information:

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 'mod FROM forum_forum f LEFT JOIN forum_posts p ON f.id = p.forum_id AND ' at line 3


The code of the concerned portion in index.php is:

$sql = <<<EOS
  SELECT f.id as id, f.forum_name as forum,
    f.forum_desc as description,
    count(forum_id) as threads, u.name as mod
  FROM forum_forum f
  LEFT JOIN forum_posts p
  ON f.id = p.forum_id
  AND p.topic_id=0
  LEFT JOIN forum_users u
  ON f.forum_moderator = u.id
  GROUP BY f.id
EOS;

Please help!

Reply With Quote
  #2 (permalink)  
Old April 26th, 2005, 06:24 PM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I too have the same problem in the same section of code.

There are others also.

Any help would be much apreciated.

Cheers

Reply With Quote
  #3 (permalink)  
Old May 5th, 2005, 04:14 PM
Registered User
 
Join Date: May 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have that error too and it is driving me nuts. Has anybody figured it out yet?

Ebony
Reply With Quote
  #4 (permalink)  
Old May 6th, 2005, 02:50 PM
Registered User
 
Join Date: May 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

EUREKA!!!! OK, don't get mad and think about the sleepless nights trying to solve this. Code should read:

$sql = <<<EOS
  SELECT f.id as id, f.forum_name as forum,
    f.forum_desc as description,
    count(forum_id) as threads, u.name as 'mod'
  FROM forum_forum f
  LEFT JOIN forum_posts p
  ON f.id = p.forum_id
  AND p.topic_id=0
  LEFT JOIN forum_users u
  ON f.forum_moderator = u.id
  GROUP BY f.id
EOS;

It should be 'mod' and not mod - something about the latter being a reserved word bla bla bla.

Ebony
Reply With Quote
  #5 (permalink)  
Old May 9th, 2005, 10:57 AM
Registered User
 
Join Date: May 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When posting a new thread, I get:

You have an error in your SQL syntax near 'ON f.id = p.forum_id JOIN forum_users u ON u.id = p.author_id LEFT JOIN forum_us' at line 1
SELECT SQL_CALC_FOUND_ROWS p.id, p.subject, p.body, p.date_posted, p.date_updated, u.name as author, u.id as author_id, u.signature as sig, c.count as postcount, p.forum_id as forum_id, f.forum_moderator as mod, p.update_id, u2.name as updated_by FROM forum_forum f JOIN forum_posts p ON f.id = p.forum_id JOIN forum_users u ON u.id = p.author_id LEFT JOIN forum_users u2 ON u2.id = p.update_id LEFT JOIN forum_postcount c ON u.id = c.user_id WHERE (p.topic_id = 1 OR p.id = 1) ORDER BY p.topic_id, p.date_posted LIMIT 0,10

Can anyone help?

Reply With Quote
  #6 (permalink)  
Old May 15th, 2005, 09:21 AM
Registered User
 
Join Date: May 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

anyone? btw this is on this forum script NOT this site that I get this message

Reply With Quote
  #7 (permalink)  
Old July 13th, 2005, 02:12 PM
Registered User
 
Join Date: Jul 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default


I finally got this script working. You have to replace all mod with 'mod' Not only in you index.php file, but also in the functions.php file.

Good luck!

Sry for my bad english.. im norwegian :)


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in Source Code in Chapter 16 Lcstyle BOOK: Beginning Linux Programming, 4th Edition ISBN 978-0-470-14762-7 1 February 28th, 2009 10:14 AM
Chapter 16 code samples freiZimmer BOOK: Professional Microsoft Robotics Studio ISBN: 978-0-470-14107-6 1 October 9th, 2008 02:24 PM
bb code in chapter 16 Jack Goa BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 April 2nd, 2007 09:26 AM
Problem with code from chapter 16 earlsinclair2001 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 December 5th, 2005 01:58 AM
Chapter 16 missing sample code bruceaj VB.NET 2002/2003 Basics 3 June 18th, 2003 08:18 AM



All times are GMT -4. The time now is 07:23 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.