Log in Register FAQ Memberlist Search Welcome to RCF - WHF Forum Index
alt : test.swf
Welcome to RCF - WHF
4fx3.gif 
calendar_open_closeCalendar 
SQL error 1064
Post new topic   Reply to topic View previous topic :: View next topic
Welcome to RCF - WHF Forum Index -> Area 51 - phpBB & Easymod Tech Support Add To Bookmarks
SQL error 1064
PostPosted: 06/27/2007 7:04 AM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 8:21 PM
greatbrE.gif
(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&amp;" . 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
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: SQL error 1064
PostPosted: 06/27/2007 12:14 PM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 8:21 PM
greatbrE.gif
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  Rolling Eyes
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: SQL error 1064
PostPosted: 06/28/2007 1:10 AM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 4:21 PM
Location: St Pete, FL
peace.gif
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'];
}

dontknow
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: SQL error 1064
PostPosted: 06/28/2007 3:30 AM Reply with quote
Citation
Karen
Citation
Posts 1253
Word Cnt. 68,166
BDay Nov 9
Sign Scorpio
Sex Sex:Female
Joined: Jan 06, 2006
Local time: 8:21 PM
greatbrE.gif
Thanks  flower
I will give it another go  blob8
Back to Top
View user's profile Find all posts by Karen Send private message   Visit poster's website Phoogle Map
Re: SQL error 1064
PostPosted: 06/28/2007 4:47 AM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 4:21 PM
Location: St Pete, FL
peace.gif
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...

dontknow
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
 Post new topic  Reply to topic
Information
Welcome to RCF - WHF Forum Index -> Area 51 - phpBB & Easymod Tech Support

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
All times are GMT - 5 Hours

Page 1 of 1


Add To Bookmarks

 
  
  


  Google

Powered by phpBB © 2001, 2005 phpBB Group

Page generation time: 0.0983s (PHP: 60% - SQL: 40%) - SQL queries: 42 - GZIP disabled - Debug on