Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

SQL Syntax Error (Aaaargh)

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
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
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back