Wrox Programmer Forums
|
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 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
 
Old July 20th, 2004, 08:32 AM
Authorized User
 
Join Date: Jul 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 15 problem

On trying to load any of the forums created (viewforum.php) I get this error message:

You have an error in your SQL syntax near '.id as topic_id, t.subject as t_subject, u.name as t_author, count(p.id) as numr' at line 1
SELECT SQL_CALC_FOUND_ROWS t.id as topic_id, t.subject as t_subject, u.name as t_author, count(p.id) as numreplies, t.date_posted as t_posted, tmp.postdate as re_posted FROM forum_users u JOIN forum_posts t ON t.author_id = u.id LEFT JOIN tmp ON t.id = tmp.topic_id LEFT JOIN forum_posts p ON p.topic_id = t.id WHERE t.forum_id = 2 AND t.topic_id = 0 GROUP BY t.id ORDER BY re_posted DESC LIMIT 0, 10

I've looked through all the other postings, and I've seen no reference to this problem. This make me think that it is something that I've done wrong!

Please, can anyone can give me a pointer as to what's gone wrong?
 
Old July 24th, 2004, 07:44 AM
Authorized User
 
Join Date: Jul 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Me again!
I've re-uploaded the original files (the ones unchanged by myself and the ones downloaded from the source code) to the server, and I am getting exactly the same error!
Therefore, it isn't anything that I've done!
PS. It is the same error whether I have changed all the known bugs in the scripts or not!

Why has no one else had this problem?

 
Old July 27th, 2004, 08:39 AM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi all,

I'm getting the same error as above:

You have an error in your SQL syntax near 'ON t.author_id = u.id LEFT JOIN tmp ON t.id = tmp.topic_id LEFT JOIN forum_posts' at line 1
SELECT SQL_CALC_FOUND_ROWS t.id as topic_id, t.subject as t_subject, u.name as t_author, count(p.id) as numreplies, t.date_posted as t_posted, tmp.postdate as re_posted FROM forum_users u JOIN forum_posts t ON t.author_id = u.id LEFT JOIN tmp ON t.id = tmp.topic_id LEFT JOIN forum_posts p ON p.topic_id = t.id WHERE t.forum_id = 1 AND t.topic_id = 0 GROUP BY t.id ORDER BY re_posted DESC LIMIT 0, 10

This only happens when clicking on the forum links - anyone have a fix for this?

- Dave
 
Old July 27th, 2004, 09:16 AM
Authorized User
 
Join Date: Jun 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just FYI, I'll take a look at this evening if I can.

 
Old August 2nd, 2004, 07:30 AM
Registered User
 
Join Date: Jul 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Any updates as to a solution for this?

- Dave

 
Old August 6th, 2004, 06:25 AM
Authorized User
 
Join Date: Jul 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
If anyone is currently working on this problem could you please place a thread to let us know.

I've now tried everything I know to fix this problem, and I can't work it out!

It definitely seems to be related to SELECT SQL_CALC_FOUND_ROWS, because if I cut it out and repeat a count it kind of works.

I shall look elsewhere if I think no one can help.

 
Old August 6th, 2004, 09:36 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In order for it to work properly you need to have MySQL 4.0.0 and up. Could u please check u have the proper version.

Christian

 
Old August 7th, 2004, 10:26 AM
Authorized User
 
Join Date: Jul 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes!
I'm running PHP 4.0
Heres the link to my phpinfo file:
http://www.trebrown.com/phpinfo.php

 
Old August 9th, 2004, 10:15 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need MYSQL 4.0.0 and up not PHP 4.0

Christian

 
Old August 9th, 2004, 03:40 PM
Authorized User
 
Join Date: Jul 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry!
I got that wrong!
If you were to look at my PHPinfo file you would see that I have PHP 4.1.2






Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 15 problem golfbird BOOK: Beginning Visual C++ 6 7 September 9th, 2008 12:29 PM
chapter 15 checkout3.php problem derrida BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 November 12th, 2006 10:11 AM
Chapter 15 Problem rsearing BOOK: Beginning ASP.NET 2.0 and Databases 3 October 12th, 2006 02:59 PM
Chapter 15 Search Problem PhilM BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 2 November 2nd, 2004 05:08 PM
A new chapter 15 problem with BBcodes PhilM BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 2 September 11th, 2004 11:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.