 |
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

April 21st, 2005, 10:59 AM
|
Registered User
|
|
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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!
|

April 26th, 2005, 06:24 PM
|
Registered User
|
|
Join Date: Apr 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I too have the same problem in the same section of code.
There are others also.
Any help would be much apreciated.
Cheers
|

May 5th, 2005, 04:14 PM
|
Registered User
|
|
Join Date: May 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have that error too and it is driving me nuts. Has anybody figured it out yet?
Ebony
|

May 6th, 2005, 02:50 PM
|
Registered User
|
|
Join Date: May 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

May 9th, 2005, 10:57 AM
|
Registered User
|
|
Join Date: May 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|

May 15th, 2005, 09:21 AM
|
Registered User
|
|
Join Date: May 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
anyone? btw this is on this forum script NOT this site that I get this message
|

July 13th, 2005, 02:12 PM
|
Registered User
|
|
Join Date: Jul 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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 :)
|
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 |
|
 |