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

June 10th, 2005, 11:41 AM
|
Registered User
|
|
Join Date: Jun 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Trouble viewing the forum (ch. 16)
I'm having trouble with my viewforum.php code. When I try and access the page, I get this error message:
Quote:
quote: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 = 1 AND t.topic_id = 0 GROUP BY t.id ORDER BY re_posted DESC, t_posted DESC, LIMIT 0, 10
|
This is the offending pice of code:
Code:
$sql = "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 = $forumid " .
"AND t.topic_id = 0 " .
"GROUP BY t.id " .
"ORDER BY re_posted DESC, t_posted DESC, " .
"LIMIT $start, $limit";
$result = mysql_query($sql)
or die(mysql_error()."<br>".$sql);
$numrows = mysql_num_rows($result);
I really can't see where I'm going wrong. Any help would be marvelous.
|

June 10th, 2005, 12:09 PM
|
Registered User
|
|
Join Date: Jun 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Also, it's running on MySQL 3.23.49 if that makes any difference.
|

August 26th, 2005, 02:02 AM
|
Registered User
|
|
Join Date: Mar 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
go to your functions.php file and change all: mod to: 'mod'
|
|
 |