cache_get_row_int error
#1

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);
Reply
#2

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.
Reply
#3

Try

Code:
Score[playerid] = cache_get_field_content_int(0, "Score", connectionHandle);
Reply
#4

Code:
error 017: undefined symbol "connectionHandle"
The field is not nullable.

Here is an image of the structure, sorry not in English.

Reply
#5

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);
Reply
#6

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
Reply
#7

Code:
Score[playerid] = cache_get_field_content_int(0, "score", kapcsolat);
Reply
#8

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
Reply
#9

Show me your onplayerlogin
Reply
#10

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!");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)