login system problems.. -
SpikeSpigel - 06.08.2015
Hi there, I made a login/register system, It works with the part on the register and then.. when I enter back on the server it tells me to put the password if the account exists, after I put the correct password I'm not being spawned -.-
This is what it says in mysql_log
Код:
[05:10:30] [DEBUG] mysql_format - connection: 1, len: 512, format: "SELECT FROM `accounts` WHERE `ID` = %d, `Username` = %e, `Password` = %e"
[05:10:30] [DEBUG] mysql_tquery - connection: 1, query: "SELECT FROM `accounts` WHERE `ID` = 3, `Username` = SpikeSpigel3", callback: "OnAccountLoad", format: "i"
[05:10:30] [DEBUG] CMySQLQuery::Execute[OnAccountLoad] - starting query execution
[05:10:30] [ERROR] CMySQLQuery::Execute[OnAccountLoad] - (error #1064) 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 'FROM `accounts` WHERE `ID` = 3, `Username` = SpikeSpigel32, `Password` = E8040D9' at line 1
[05:10:30] [DEBUG] CMySQLQuery::Execute[OnAccountLoad] - error will be triggered in OnQueryError
And then..this is the accountload public.
Код:
forward OnAccountLoad(playerid);
public OnAccountLoad(playerid)
{
TogglePlayerSpectating(playerid, false);
SetSpawnInfo(playerid, 0, 23, SPAWN_X, SPAWN_Y, SPAWN_Z, SPAWN_A, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
return 1;
}
and the login part with the SELECT * FROM `accounts` .. etc
Код:
mysql_format(MySQL, query, sizeof(query), "SELECT FROM `accounts` WHERE `ID` = %d, `Username` = %e, `Password` = %e",Player[playerid][ID], playername, Player[playerid][Password]);
mysql_tquery(MySQL, query, "OnAccountLoad", "i", playerid);
Anybody has any idea why the hell it's not F'n working ? -.- I tried for hours to F'n repair that F'n system and still not F'n working
Re: login system problems.. -
MarvinPWN - 06.08.2015
I said to you that you have to use
' when you work with strings.
PHP код:
mysql_format(MySQL, query, sizeof(query), "SELECT * FROM `accounts` WHERE `ID` = %d AND `Username` = '%e' AND `Password` = '%e'",Player[playerid][ID], playername, Player[playerid][Password]);
Re: login system problems.. -
SpikeSpigel - 06.08.2015
Well, that worked so well. I was such an idiot, you were right.. I just put something wrong int he code -.-. Thx +rep :P