cache_get_row_int error -
SecretMax - 25.08.2017
Hello, I wrote a very basic registration and login system with the R39-2 mysql version, all good except for loading the player's data. This error was received in mysql log:
Code:
[ERROR] cache_get_row_int - invalid datatype
Of course, it does not load the data to the player either.
Code:
Score[playerid] = cache_get_row_int(0,2);
Re: cache_get_row_int error -
Misiur - 25.08.2017
Is the field nullable? You might be retrieving null which is not a number. Either set the field to not nullable, or check for it first.
Re: cache_get_row_int error -
skuller12 - 25.08.2017
Try
Code:
Score[playerid] = cache_get_field_content_int(0, "Score", connectionHandle);
Re: cache_get_row_int error -
SecretMax - 25.08.2017
Code:
error 017: undefined symbol "connectionHandle"
The field is not nullable.
Here is an image of the structure, sorry not in English.
Re: cache_get_row_int error -
skuller12 - 25.08.2017
You may have a handle instead of connectionHandle or mysql_db
Show me your mysql_connect: ex: handle = mysql_connect(..., ..., ..., ...);
Code:
Score[playerid] = cache_get_field_content_int(0, "score", handle);
Re: cache_get_row_int error -
SecretMax - 25.08.2017
Code:
kapcsolat = mysql_connect( MYSQL_HOST, MYSQL_USER, MYSQL_DB, MYSQL_PASS );
Code:
[11:13:04 08/25/17] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0') (Query: "SELECT * FROM players Where name = 'Tester' AND password = 'C'")
[11:13:04 08/25/17] [ERROR] cache_get_field_content_int - invalid datatype
Re: cache_get_row_int error -
skuller12 - 25.08.2017
Code:
Score[playerid] = cache_get_field_content_int(0, "score", kapcsolat);
Re: cache_get_row_int error -
SecretMax - 25.08.2017
Not working.
Code:
[11:13:04 08/25/17] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0') (Query: "SELECT * FROM players Where name = 'Tester' AND password = 'C'")
[11:13:04 08/25/17] [ERROR] cache_get_field_content_int - invalid datatype
Re: cache_get_row_int error -
skuller12 - 25.08.2017
Show me your onplayerlogin
Re: cache_get_row_int error -
SecretMax - 25.08.2017
Code:
CMD:login(playerid,params[])
{
if(Regelt[playerid])
{
if(Belepve[playerid]) return SendClientMessage(playerid,-1,"You are already logged in!");
new jelszo[128];
if(sscanf(params,"s[128]",jelszo)) return SendClientMessage(playerid,-1,"Usage: /login [Password]");
new nev[MAX_PLAYER_NAME];
GetPlayerName(playerid,nev,sizeof(nev));
format(Query, sizeof(Query), "SELECT * FROM players WHERE name = '%s' AND password = '%s'", nev, Whirlpool(jelszo));
mysql_tquery(kapcsolat, Query, "Login","dd",playerid,Whirlpool(jelszo));
}
else SendClientMessage(playerid,-1,"Use /register!");
return 1;
}
Code:
fpublic Login(playerid,jelszo)
{
if(cache_get_row_count() == 0)
{
SendClientMessage(playerid,-1,"Wrong password!");
Kick_(playerid);
}
else
{
SendClientMessage(playerid,-1,"You have successfully logged in!");
Belepve[playerid] = true;
new nev[MAX_PLAYER_NAME];
GetPlayerName(playerid,nev,sizeof(nev));
format(Query, sizeof(Query), "SELECT * FROM players WHERE name = '%s' AND password = '%s'", nev, jelszo);
mysql_tquery(kapcsolat,Query,"JatekosBetoltese","d",playerid);
}
}
Code:
fpublic JatekosBetoltese(playerid)
{
Score[playerid] = cache_get_field_content_int(0, "score", kapcsolat);
SpawnPlayer(playerid);
SendClientMessage(playerid,-1,"Successfully loaded!");
}