Sub Menu
Links Menu
Online Users

In total there are 659 users online :: 2 registered, 0 hidden and 657 guests

Most users ever online was 1091 on Wed Aug 16, 2023 5:27 pm

Registered users: Bing [Bot], Google [Bot] based on users active over the past 60 minutes

SQL syntax

Support for the IM Portal Project

Moderator: Integra Moderator

SQL syntax

PostAuthor: midjam » Mon Feb 12, 2007 2:25 pm

Hi guys

Please could someone help me with an error i`m getting.

I have phpBB and IM Portal

Whenever i go to reply to a post and i scroll down to see what has been posted i get this error message

Could not query users

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 '' at line 4

SELECT username, user_id, user_posts, user_avatar, user_avatar_type, user_allowavatar FROM phpbb_users WHERE user_id <> -1 ORDER BY user_posts DESC LIMIT

Line : 38
File : blocks_imp_top_posters.php


I can post and everything works ok, but how do i get rid of this error?
Last edited by midjam on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

midjam
Newbie
Newbie
 
Posts: 17
Likes: 0 post
Liked in: 0 post
Joined: Sun Jan 28, 2007 1:55 am
Cash on hand: 0.00

PostAuthor: Michaelo » Mon Feb 12, 2007 8:49 pm

Ca you open blocks_imp_top_posters.php and post the line 38 here so I can see what it is...
It should be something like:
Code: Select all
                  WHERE user_id <> " . ANONYMOUS . "  


Mike
Last edited by Michaelo on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
Kiss Portal Engine phpbbireland (status: Released)
User avatar
Michaelo
Administrator
Administrator
 
Posts: 1646
Likes: 0 post
Liked in: 0 post
Joined: Sat Mar 11, 2006 5:14 pm
Cash on hand: 0.00
Location: Dublin, Ireland

Re: SQL syntax

PostAuthor: midjam » Tue Feb 13, 2007 12:53 am

Thanks for your help

I have posted all the code


if ( !defined('IN_PHPBB') )
{
die("Hacking attempt");
}

if(!function_exists(imp_top_posters_func))
{
function imp_top_posters_func()
{
global $lang, $template, $portal_config, $board_config, $db, $phpEx;

$sql = "SELECT username, user_id, user_posts, user_avatar, user_avatar_type, user_allowavatar
FROM " . USERS_TABLE . "
WHERE user_id <ANONYMOUS>sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
}

if ( $row = $db->sql_fetchrow($result) )
{
$i = 0;
do
{
$username = $row['username'];
$user_id = $row['user_id'];
$posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0;
$poster_avatar = '';
if ( $row['user_avatar_type'] && $user_id != ANONYMOUS && $row['user_allowavatar'] )
{
switch( $row['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img>' : '';
break;
case USER_AVATAR_REMOTE:
$poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img>' : '';
break;
case USER_AVATAR_GALLERY:
$poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img>' : '';
break;
}
}



$template->assign_block_vars('topposter', array(
'USERNAME' => $username,
'POSTS' => $posts,
'AVATAR_IMG' => $poster_avatar,
'U_VIEWPOSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"),
'U_VIEWPOSTS' => append_sid("search.php?search_author=" . $username . "&showresults=posts")
)
);

$i++;
}
while ( $row = $db->sql_fetchrow($result) );
}

$template->assign_vars(array(
'L_POSTS' => $lang['Posts']
)
);
}
}

imp_top_posters_func();
Last edited by midjam on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.

midjam
Newbie
Newbie
 
Posts: 17
Likes: 0 post
Liked in: 0 post
Joined: Sun Jan 28, 2007 1:55 am
Cash on hand: 0.00

PostAuthor: Michaelo » Tue Feb 13, 2007 1:54 am

Have you 141 or 140?
If 141 the mod has not been installed so iy can't be used. Disable the block in ACP-IM Portal...
If 140, check ACP - > IM Portal -> Portal Configuration and see if you have an entry for md_total_poster or just total_poster... if so make sure it is a positive number, say 5...

Let me know how you get on...
Mike
Last edited by Michaelo on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
Kiss Portal Engine phpbbireland (status: Released)
User avatar
Michaelo
Administrator
Administrator
 
Posts: 1646
Likes: 0 post
Liked in: 0 post
Joined: Sat Mar 11, 2006 5:14 pm
Cash on hand: 0.00
Location: Dublin, Ireland


Return to IM Portal Support Forum

Who is online

Registered users: Bing [Bot], Google [Bot]

cron