Jump to content

Recommended Posts

Posted (edited)

Ok all you sql gurus, I have an issue I need a hand with.

First off, I must confess how much I SUCK at sql statements and trying to debug errors. This one is throwing errors. You probably see it but I don't. Have any clues? if so I should am all ears and willing to listen/read. I been banging my head on this part of the night.

$sql = "SELECT username, user_id, user_posts, user_avatar, user_avatar_type, user_allowavatar
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
ORDER BY user_posts DESC LIMIT " . $portal_config['md_total_poster'];
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
}

Here is the exact error word.

General Error

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

Anyhow, here it is in all its glory. this has nothing to do with phpvms I just needed some insight so I figured I would toss it in off topic talk.

Thanks for taking a look.

Edited by TAV1702
Posted (edited)

It doesn't look like

$portal_config['md_total_poster'];

is printing out anything. Did you spell that right? Try to echo it to debug it.

Should compile if

ORDER BY user_posts DESC LIMIT " . $portal_config['md_total_poster'];

is replaced to

ORDER BY user_posts DESC LIMIT 5";

The syntax looks right. It's gotta be some misspelling somewhere.

Edited by magicflyer
Posted (edited)

Ahhh it did not register with me until you posted and I read it with my own eyes. You got it right on your first try. It was the

$portal_config['md_total_poster'];

I never even noticed but that option was removed from the version of software I upgraded to. DOH!!! :blink: That is why my query was failing. Well, part of the reason. It still has a syntax error but now I know it isn't even worth my time as that total poster option is removed.

Thanks for taking a look man I appreciate it.

Essentially what that little option was is a config option in the admin control panel to tell a block on home page how many top forum posters to show in a block. Well, the top posters option was removed in the upgraded version. I would say it is to save sql querys on the server which would be ridiculous as it is only 5 querys compared to the dozens that are ran when people are online using country and state flags.

Edited by TAV1702
  • Like 1
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...