NameSilo

SQL Syntax Error (Aaaargh)

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
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
Close
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
Close
Thanks again SecondVersion :bingo: :)
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back