SA-MP Forums Archive
Problem in MySQL, help - 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: Problem in MySQL, help (/showthread.php?tid=646431)



Problem in MySQL, help - GuilhermeH - 17.12.2017

When I try to check if an account already exists in my login system, I come across the following error

** [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 ''Alfred_Mister'' at line 1

Code responsible for verification:

Код:
function:Player_Init(playerid)
{
	static const empty_player[playerData];
	PlayerData[playerid] = empty_player;

	GetPlayerName(playerid, PlayerData[playerid][pUsername], MAX_PLAYER_NAME);


	new query[103];
	mysql_format(g_iHandle, query, sizeof query, "SELECT * FROM `characters` WHERE `AcountName` = '%s' LIMIT 1", PlayerData[playerid][pUsername]);
	mysql_tquery(g_iHandle, query, "r@Player_Init", "d", playerid);

	return true;
}



Re: Problem in MySQL, help - RIDE2DAY - 17.12.2017

Being honest, the query looks alright to me, it runs fine on my server actually. Give a try without the quotes and escaping the nickname:
PHP код:
SELECT FROM characters WHERE AcountName '%e' LIMIT 1
Which plugin version are you using?


Re: Problem in MySQL, help - GuilhermeH - 17.12.2017

Quote:
Originally Posted by RIDE2DAY
Посмотреть сообщение
Being honest, the query looks alright to me, it runs fine on my server actually. Give a try without the quotes and escaping the nickname:
PHP код:
SELECT FROM characters WHERE AcountName '%e' LIMIT 1
Which plugin version are you using?
R39-6

The error persists