SA-MP Forums Archive
[MySQL]: You have an error in your SQL syntax - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [MySQL]: You have an error in your SQL syntax (/showthread.php?tid=540303)



[MySQL]: You have an error in your SQL syntax - ShiffeyTheGamer - 04.10.2014

When I try to regsiter in my server the thing wont come up to pick my skin and when I look in logs I get this

** [MySQL]: 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 '= '', 'Warnings' = '0', 'Warn1' = 'NULL', 'Warn2' = 'NULL', 'MaskID' = '33470', ' at line 1


Re: [MySQL]: You have an error in your SQL syntax - ZBits - 04.10.2014

Show your Query code


Re: [MySQL]: You have an error in your SQL syntax - ShiffeyTheGamer - 04.10.2014

What's that?


Re: [MySQL]: You have an error in your SQL syntax - biker122 - 04.10.2014

Show your register code.


Re: [MySQL]: You have an error in your SQL syntax - Shaneisace - 04.10.2014

Don't use '' around integers you only need to use them on strings.

also i think you either have an ' in a wrong location or you have 2 of them in the wrong location.


Re: [MySQL]: You have an error in your SQL syntax - ShiffeyTheGamer - 04.10.2014

I think this is it..

Код:
 );
	format(query, sizeof(query), "%s, 'Warnings' = '%d', 'Warn1' = '%s', 'Warn2' = '%s', 'MaskID' = '%d', 'FactionMod' = '%d', 'Capacity' = '%d' WHERE 'ID' = '%d'",
	    query,
	    PlayerData[playerid][pWarnings],
	    SQL_ReturnEscaped(PlayerData[playerid][pWarn1]),
	    SQL_ReturnEscaped(PlayerData[playerid][pWarn2]),
	    PlayerData[playerid][pMaskID],
	    PlayerData[playerid][pFactionMod],
	    PlayerData[playerid][pCapacity],
		PlayerData[playerid][pID]
	);
	mysql_function_query(g_iHandle, query, false, "", "");

	SQL_SaveAccessories(playerid);
	return 1;
}



Re: [MySQL]: You have an error in your SQL syntax - Ox1gEN - 04.10.2014

You don't use UPDATE, INSERT or any kind of other statement before anything else, plus you don't need that %s string in the front, and don't use ' ' they are for string specifiers only.


Re: [MySQL]: You have an error in your SQL syntax - ShiffeyTheGamer - 05.10.2014

Could someone fix it for me and paste to code here? Not really sure what you guys mean and now to correct it.