PDA

View Full Version : mysql error, help >_<


Takara
06-24-2002, 11:23 AM
Whenever I go to the admin CP, then to edit a user I get the following error message (it occours for every user, not just 'Takky'):

Database error in vBulletin Control Panel 2.2.5:

Invalid SQL: SELECT userid
FROM user
WHERE username='Takky'
AND userid <>
mysql error: You have an error in your SQL syntax near '' at line 4

mysql error number: 1064

Date: Monday 24th of June 2002 08:14:46 AM
Script: http://myforums/admin/user.php
Referer: http://myforums/admin/user.php?s=&action=edit&userid=15


This is the code around the area:


// ###################### Start do update #######################
if ($HTTP_POST_VARS['action']=="doupdate") {

if (!isset($ausername) or $ausername == '') {
echo "<p>You did not give this user an username</p>";
exit;
}

if ($exists=$DB_site->query_first("SELECT userid
FROM user
WHERE username='".addslashes(htmlspecialchars($ausername))."'
AND userid <> $userid")) {
echo "There is already an ".makelinkcode('user',"user.php?do=edit&userid=$exists[userid]",1)." named <b>".htmlspecialchars($ausername)."</b>";
exit;
}

// check that not removing last admin
$countadmin=$DB_site->query_first("SELECT COUNT(*) AS users FROM user,usergroup WHERE user.usergroupid=usergroup.usergroupid AND usergroup.cancontrolpanel=1 AND user.userid<>$userid");
$getperms=$DB_site->query_first("SELECT cancontrolpanel FROM usergroup WHERE usergroupid=$usergroupid");
if ($countadmin[users]==0 and $getperms[cancontrolpanel]!=1) {
echo "<p>You are about to edit the last user with control panel access so that they do not have control panel access. This would lock you out of the control panel, so you cannot proceed.</p></body></html>";
exit;
}


I hadnt done anything recently, except add log's thread subscribe hack.. but that edits showthread.php, not user.php

Can anyone give me a hand?

Admin
06-24-2002, 12:49 PM
Install 2.2.6 to fix this problem, or apply the PHP 4.2.x-related patches from vBulletin.com.

Takara
06-24-2002, 01:08 PM
I'm slowly moving all my hacks over to 2.2.6, but I have to check each file for changes and then after all that I'm sure there will be errors I have to check. It didnt pop up until just now, what is there that I can do until I've got all my files upgraded and ready?

Takara
06-24-2002, 05:43 PM
>_< I need to ban someone but It just gives me the error, there has to be something I can do shorterm @_@;

Steve Machol
06-24-2002, 05:50 PM
FireFly already told you how to fix this. You need to either upgrade to vB 2.2.6 OR apply the patched files in freddie's post here:

http://www.vbulletin.com/forum/showthread.php?s=&threadid=44820

Takara
06-24-2002, 05:52 PM
Oooooohhhhh, I searched through the member area for the upgrade, but didnt find it. lol

I'm so stupid. Sorry, thank thanks *updates*

Takara
06-24-2002, 11:55 PM
Phew, all upgraded!

*continues slowly updating her files O.o*

Thanks both of you ^^