SA-MP Forums Archive
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: Mysql help (/showthread.php?tid=540868)



Mysql help - jeffery30162 - 07.10.2014

I am currently switching to mysql. The server has a connection to the Mysql database but, when the player connects to the server and his account is checked to see if it is reqistered or not it acts like he is not registered even though he is.

Here is the code portion that has the issue:
Код:
new query[200], rows, fields, string[128];
		mysql_format(MySQLCon, query, sizeof(query),"SELECT * FROM 'accounts' WHERE `Username` = '%s'", RPNU(playerid));
  		mysql_query(MySQLCon, query);
    	        cache_get_data(rows, fields, MySQLCon);
		if(rows > 0)
		{
		    SSSShowDialog(playerid, 2); // Account exists foward to login screen
		}
		else
		{
			SSSShowDialog(playerid, 1); // Account does not exists foward to register screen
		}
Even though the account is registered, it always gows to SSSShowDialog(playerid, 1);


Re: Mysql help - Vince - 07.10.2014

Query is wrong. ' (single quote) and ` (backtick) are not the same thing and can't be used interchangeably.


Re: Mysql help - jeffery30162 - 07.10.2014

im still confused, can you show me?


Re: Mysql help - TakeiT - 07.10.2014

Код:
mysql_format(MySQLCon, query, sizeof(query),"SELECT * FROM 'accounts' WHERE `Username` = '%s'", RPNU(playerid));
Should be

Код:
mysql_format(MySQLCon, query, sizeof(query),"SELECT * FROM `accounts` WHERE `Username` = '%s'", RPNU(playerid));
Vince is talking about 'accounts' in your query, the ' should be `