SQL syntax help?

Hey there guys,
I am trying to insert a record into ze table but I am getting this error when I try to:

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 '; VALUES ('John_Smith', `1`, `1`, `1643.188842`, `-2291.253417`, `' at line 1

The two lines:

mysql_query("INSERT INTO `playeraccounts` (`playerName`, `owner`, `playerSkin`, `playerPosX`, `playerPosY`, `playerPosZ`, `playerMoney`, `playerGender`);
	    VALUES ('" . $playerName . "', `$userID`, `1`, `1643.188842`, `-2291.253417`, `-1.196046`, `100`, `-1`'" . $playerGender . "'") or die(mysql_error());

Thanks for your time, and help!

remove the value enclosing tilt (`) characters from VALUES part of INSERT query or you can remove it from complete INSERT query

I will try it.

Thanks for the post.


the problem is the semi-colon

look at exactly where the error message says to look near

1 Like



Could you be more specific sir ?

look at what comes right after the word “near”

it’s barfing on the semi-colon

semi-colons are used to terminate sql statements

so your INSERT statement terminates without a VALUES clause

hence the error

1 Like