SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 25/08/2017, 08:17 AM   #1
SecretMax
Little Clucker
 
Join Date: May 2017
Location: Hungary
Posts: 26
Reputation: 0
Default cache_get_row_int error

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);
SecretMax is offline   Reply With Quote
Old 25/08/2017, 08:22 AM   #2
Misiur
High-roller
 
Misiur's Avatar
 
Join Date: Jul 2009
Location: Poland
Posts: 2,528
Reputation: 556
Default Re: cache_get_row_int error

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.
Misiur is offline   Reply With Quote
Old 25/08/2017, 08:28 AM   #3
skuller12
Big Clucker
 
Join Date: Feb 2015
Location: Galati, Romania
Posts: 101
Reputation: 0
Default Re: cache_get_row_int error

Try

Code:
Score[playerid] = cache_get_field_content_int(0, "Score", connectionHandle);
skuller12 is offline   Reply With Quote
Old 25/08/2017, 08:31 AM   #4
SecretMax
Little Clucker
 
Join Date: May 2017
Location: Hungary
Posts: 26
Reputation: 0
Default Re: cache_get_row_int error

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

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


Last edited by SecretMax; 25/08/2017 at 09:10 AM.
SecretMax is offline   Reply With Quote
Old 25/08/2017, 09:19 AM   #5
skuller12
Big Clucker
 
Join Date: Feb 2015
Location: Galati, Romania
Posts: 101
Reputation: 0
Default Re: cache_get_row_int error

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);
skuller12 is offline   Reply With Quote
Old 25/08/2017, 09:21 AM   #6
SecretMax
Little Clucker
 
Join Date: May 2017
Location: Hungary
Posts: 26
Reputation: 0
Default Re: cache_get_row_int error

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
SecretMax is offline   Reply With Quote
Old 25/08/2017, 11:08 AM   #7
skuller12
Big Clucker
 
Join Date: Feb 2015
Location: Galati, Romania
Posts: 101
Reputation: 0
Default Re: cache_get_row_int error

Code:
Score[playerid] = cache_get_field_content_int(0, "score", kapcsolat);
skuller12 is offline   Reply With Quote
Old 25/08/2017, 11:43 AM   #8
SecretMax
Little Clucker
 
Join Date: May 2017
Location: Hungary
Posts: 26
Reputation: 0
Default Re: cache_get_row_int error

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
SecretMax is offline   Reply With Quote
Old 25/08/2017, 12:25 PM   #9
skuller12
Big Clucker
 
Join Date: Feb 2015
Location: Galati, Romania
Posts: 101
Reputation: 0
Default Re: cache_get_row_int error

Show me your onplayerlogin
skuller12 is offline   Reply With Quote
Old 25/08/2017, 12:53 PM   #10
SecretMax
Little Clucker
 
Join Date: May 2017
Location: Hungary
Posts: 26
Reputation: 0
Default Re: cache_get_row_int error

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!");
}
SecretMax is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cache_get_row_int error Japanda Scripting Help 2 15/12/2015 04:36 PM
[Help]Problem with cache_get_row_int [ REP ++ ] buburuzu19 Scripting Help 2 14/01/2015 10:09 PM
MySQL Help [Cache_get_row_int firemanjv Scripting Help 4 17/01/2014 09:52 AM
cache_get_row_int and cache_get_row_float AphexCCFC Scripting Help 1 17/09/2013 03:38 PM
cache_get_row_int(...) - An error occured during the datatype conversion. zombieking Scripting Help 2 28/05/2013 10:21 AM


All times are GMT. The time now is 12:50 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.