MyBB Community Forums

Full Version: [MyBB 1.2] MemberList error after upgrade
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello to all!
After i have to upgrade my version of forum from 1.1.8 to 1.2 i have discovered a problem.

When i want to see the memberlist, recived this error
MySQL 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 'LIMIT 0, 20' at line 5
Query: SELECT u.*, f.* FROM mybb_users u LEFT JOIN mybb_userfields f ON (f.ufid=u.uid) ORDER BY u. LIMIT 0, 20

the error can found at this part of sql code :
ORDER BY u. LIMIT 0, 20

I try to modify the sql statement like this :
SELECT u.*, f.* FROM mybb_users u LEFT JOIN mybb_userfields f ON (f.ufid=u.uid) ORDER BY u.uid LIMIT 0, 20

and work correctly

Good Bye

Leandro
he is right..I am starting to update a couple forums I have as well.

memberlist.php

if($mybb->input['usersearch'])
{
	$query = $db->query("
		SELECT u.*, f.*
		FROM ".TABLE_PREFIX."users u
		LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)
		WHERE u.username LIKE '%".$db->escape_string($mybb->input['usersearch'])."%'
		ORDER BY u".$mybb->input['by']." ".$mybb->input['order']."
		LIMIT $start, ".$mybb->settings['membersperpage']
	);
}
else
{
	$query = $db->query("
		SELECT u.*, f.*
		FROM ".TABLE_PREFIX."users u
		LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)
		ORDER BY u.".$mybb->input['by']." ".$mybb->input['order']."
		LIMIT $start, ".$mybb->settings['membersperpage']
	);
}

That code doesn't work right.

I changed mine to this:

if($mybb->input['usersearch'])
{
	$query = $db->query("
		SELECT u.*, f.*
		FROM ".TABLE_PREFIX."users u
		LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)
		WHERE u.username LIKE '%".$db->escape_string($mybb->input['usersearch'])."%'
		ORDER BY u.uid".$mybb->input['by']." ".$mybb->input['order']."
		LIMIT $start, ".$mybb->settings['membersperpage']
	);
}
else
{
	$query = $db->query("
		SELECT u.*, f.*
		FROM ".TABLE_PREFIX."users u
		LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)
		ORDER BY u.uid".$mybb->input['by']." ".$mybb->input['order']."
		LIMIT $start, ".$mybb->settings['membersperpage']
	);
}

I am using mysql 4.  I don't understand how this isn't an issue for others as well.

EDIT: I had to go into the admincp and save a new setting for the memberlist and then it worked fine. I think the upgrade process is not setting the memberlist default properly. I think mine was set to uid but the new choices are regdate, username, or postcount. Please fix this asap.