 | SQL error 1064 |  |
Posted: 06/27/2007 7:04 AM |
|
|
|
|
|
| Citation |
| Posts |
1253 |
| Word Cnt. |
68,166 |
| BDay |
Nov 9 |
| Sign |
Scorpio |
| Sex |
 |
|
|
|
Joined: Jan 06, 2006
Local time: 7:29 PM
|

|
|
|
|
 |
(This is for the portal on topparenting sites.com)
So far I've managed to trace and sort any out but I just cannot see it this time. Could it actually be in my database rather than a file error?
| Code:
|
Could not query recent topics information
DEBUG MODE
SQL Error : 1064 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 ') AND t.topic_status <> 2 AND p.post_id = t.topic_last_post_id AN' at line 3
SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username FROM phpbb_topics AS t, phpbb_posts AS p, phpbb_users AS u WHERE t.forum_id NOT IN (1, 2, 4, 20, 21,) AND t.topic_status <> 2 AND p.post_id = t.topic_last_post_id AND p.poster_id = u.user_id ORDER BY p.post_id DESC LIMIT 10
Line : 98
File : blocks_imp_recent_topics.php
|
And here is my file.
| Code:
|
<?php
/********************************************************************* ******
* blocks_imp_recents_topic.php
* -------------------
* begin : Saturday, March 20, 2004
* copyright : (C) 2004 masterdavid - Ronald John David
* website : http://www.integramod.com
* email :
*
* note: removing the original copyright is illegal even you have modified
* the code. Just append yours if you have modified it.
********************************************************************* ******
*
* Code modified by AmigaLink (Markus Schmidt) http://www.amigalink.de
*
********************************************************************* ******/
/********************************************************************* ******
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
********************************************************************* ******/
if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
}
if(!function_exists(imp_recent_topics_block_func))
{
function imp_recent_topics_block_func()
{
global $template, $portal_config, $userdata, $board_config, $db, $phpEx, $lang;
$sql = "SELECT * FROM ". FORUMS_TABLE . " ORDER BY forum_id";
if (!$result1 = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
}
$forum_data = array();
while( $row1 = $db->sql_fetchrow($result1) )
{
$forum_data[] = $row1;
}
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data);
if( $portal_config['md_except_forum_id'] == '' )
{
$except_forum_id = '\'start\'';
}
else
{
$except_forum_id = $portal_config['md_except_forum_id'];
}
for ($i = 0; $i < count($forum_data); $i++)
{
if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
{
if ($except_forum_id == '\'start\'')
{
$except_forum_id = $forum_data[$i]['forum_id'];
}
else
{
$except_forum_id .= ',' . $forum_data[$i]['forum_id'];
}
}
}
if ($portal_config['md_show_not_forums']){
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
WHERE t.forum_id NOT IN (" . $except_forum_id . ")
AND t.topic_status <> 2
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u.user_id
ORDER BY p.post_id DESC
LIMIT " . $portal_config['md_num_recent_topics'];
}else{
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
WHERE t.forum_id IN (" . $except_forum_id . ")
AND t.topic_status <> 2
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u.user_id
ORDER BY p.post_id DESC
LIMIT " . $portal_config['md_num_recent_topics'];
}
if (!$result1 = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);
}
$number_recent_topics = $db->sql_numrows($result1);
$recent_topic_row = array();
while ($row1 = $db->sql_fetchrow($result1))
{
$recent_topic_row[] = $row1;
}
if($portal_config['md_recent_topics_style']){
$style_row = 'scroll';
}else
{
$style_row = 'static';
}
$template->assign_block_vars($style_row,"");
for ($i = 0; $i < $number_recent_topics; $i++)
{
$template->assign_block_vars($style_row . '.recent_topic_row', array(
'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'],
'L_TITLE' => $recent_topic_row[$i]['topic_title'],
'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $recent_topic_row[$i]['user_id']),
'S_POSTER' => $recent_topic_row[$i]['username'],
'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])
)
);
}
$template->assign_vars(array(
'BY' => $lang['by'],
'ON' => $lang['on']
));
}
}
imp_recent_topics_block_func();
?>
|
|
|
|
 |
 |
| Back to Top |
|
|
 | Re: SQL error 1064 |  |
Posted: 06/27/2007 12:14 PM |
|
|
|
|
|
| Citation |
| Posts |
1253 |
| Word Cnt. |
68,166 |
| BDay |
Nov 9 |
| Sign |
Scorpio |
| Sex |
 |
|
|
|
Joined: Jan 06, 2006
Local time: 7:29 PM
|

|
|
|
|
 |
Argh, I tried to fix it and now I got Template->make_filename(): Error - file layout/a does not exist
I think I might have to uninstall it and start again  |
|
|
 |
 |
| Back to Top |
|
|
 | Re: SQL error 1064 |  |
Posted: 06/28/2007 1:10 AM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 3:29 PM
Location: St Pete, FL
|

|
|
|
|
 |
I don't see any legitimate reason why this might be happening. You can try the following to see if it cures it though...
OPEN
blocks_imp_recent_topics.php
FIND
| Code:
|
if ($except_forum_id == '\'start\'')
{
$except_forum_id = $forum_data[$i]['forum_id'];
}
else
{
$except_forum_id .= ',' . $forum_data[$i]['forum_id'];
}
|
REPLACE WITH
| Code:
|
if ($except_forum_id == '\'start\'')
{
$except_forum_id = $forum_data[$i]['forum_id'];
}
else if ( trim(strval($forum_data[$i]['forum_id'])) != '' )
{
$except_forum_id .= ',' . $forum_data[$i]['forum_id'];
}
|
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: SQL error 1064 |  |
Posted: 06/28/2007 3:30 AM |
|
|
|
|
|
| Citation |
| Posts |
1253 |
| Word Cnt. |
68,166 |
| BDay |
Nov 9 |
| Sign |
Scorpio |
| Sex |
 |
|
|
|
Joined: Jan 06, 2006
Local time: 7:29 PM
|

|
|
|
|
 |
Thanks
I will give it another go  |
|
|
 |
 |
| Back to Top |
|
|
 | Re: SQL error 1064 |  |
Posted: 06/28/2007 4:47 AM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 3:29 PM
Location: St Pete, FL
|

|
|
|
|
 |
I hope it makes a difference. I'm not confident that it will though because the code that was there should have been working properly too...
 |
|
|
 |
 |
| Back to Top |
|
|
 | Information |  |
|