NameSilo

SQL Syntax Error (Aaaargh)

Spaceship Spaceship
Watch

noswad

Established Member
Impact
1
Hi

Im getting the following syntax error for the code below...

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 '(no_access, type) WHERE no_access = 'noswad'' at line 1

PHP:
if ($_POST[lift_user_ban] != "")
{

		$lift_user = "DELETE FROM banned (no_access, type) WHERE no_access = '$_POST[lift_user_ban]'";
		$result = @mysql_query($lift_user,$connection) or die(mysql_error());
		$msg .= "The Ban for user $_POST[lift_user_ban] has been lifted.<br>";

}
Can anyone see an error?

Thanks for looking.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
DELETE syntax:
Code:
DELETE FROM table WHERE condition

Yours should be:
PHP:
if ($_POST[lift_user_ban] != "")
{
    $lift_user = "DELETE FROM banned WHERE no_access = '$_POST[lift_user_ban]'";
    $result = @mysql_query($lift_user,$connection) or die(mysql_error());
    $msg .= "The Ban for user $_POST[lift_user_ban] has been lifted.<br>";
}
 
0
•••
Thanks again SecondVersion :bingo: :)
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back