PDA

View Full Version : Where's the Database Error?


Bison
09-17-2002, 01:12 PM
I get this error:


Database error in vBulletin Control Panel 2.2.6:

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

mysql error number: 1064


In the "forum/admin/user.php" file...


Here's The Code (From the user.php file):


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;
}


It was working fine before and then POOF! :(

FlyingDutchman
09-17-2002, 01:17 PM
shouldn't userid <> $userid be replaced by: userid='$userid'?

try this code instead then:


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;
}

Bison
09-17-2002, 01:20 PM
I'll try it ... but that generally means the same thing (<>).

Thanks for responding!

Bison
09-17-2002, 01:30 PM
That didn't work ... I got another error using that <> qualifer that pointed to "Check Not Removing Last Admin" :(