MYSQL not saving data
#1

So everything is okay with the data in game, i tested it with stats command, Also updates when i manually change it from the database, but just when i change something ingame and relog, its gone.

On player disconnect.
Код:
Corrupt_Check[playerid]++;

	new DB_Query[550];
	mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `accounts` SET `Level` = %d, `VIP` = %d, `KILLS` = %d, `DEATHS` = %d, `BANNED` = %d WHERE `ID` = %d LIMIT 1",
	PlayerInfo[playerid][Level], PlayerInfo[playerid][VIP], PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], PlayerInfo[playerid][Banned], PlayerInfo[playerid][ID]);

	mysql_tquery(Database, DB_Query);

	if(cache_is_valid(PlayerInfo[playerid][Player_Cache])) 
	{
		cache_delete(PlayerInfo[playerid][Player_Cache]); 
		PlayerInfo[playerid][Player_Cache] = MYSQL_INVALID_CACHE;
	}
Reply
#2

Код:
new DB_Query[550];
mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `accounts` SET `Level` = '%d', `VIP` = '%d', `KILLS` = '%d', `DEATHS` = '%d', `BANNED` = '%d' WHERE `ID` = %d LIMIT 1",
PlayerInfo[playerid][Level], PlayerInfo[playerid][VIP], PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], PlayerInfo[playerid][Banned], PlayerInfo[playerid][ID]);

mysql_tquery(Database, DB_Query);

if(cache_is_valid(PlayerInfo[playerid][Player_Cache]))
{
	cache_delete(PlayerInfo[playerid][Player_Cache]);
	PlayerInfo[playerid][Player_Cache] = MYSQL_INVALID_CACHE;
}
Reply
#3

Thanks guys, but it's still not saving...
Reply
#4

Post your mysql_log and a screenshot of the table, please
Reply
#5

Enable MySQL logging and present the error that's being provided to you in the server logs. It's preferable that you enable LOG_ALL so everything is logged regardless whether it has an error or not, helps us get the better picture without the need of SSing your table.
Reply
#6

Thats a picture of my table "didnt want to post it directly in here because its too big.."

https://i.imgur.com/PH84mTn.png


Код:
[01:04:58]  Loading plugin: mysql
[01:04:58]  >> plugin.mysql: R41-2 successfully loaded.
log:
Код:
[01:11:05] [WARNING] mysql_connect: no password specified
[01:11:05] [WARNING] mysql_connect: no password specified
[01:11:05] [WARNING] duplicate connection detected: handle id 1 already exists with host = 'localhost', username = 'root' and database = 'htb'
It doesnt support multiple clients?
Reply
#7

Could be a lot of things. Does the data persist when it's manual input into the DB? Are you even sure the data is inserted into the DB from ingame at all?

Try adding something ingame and check the sql console immediately afterwards.

EDIT: Apologies, misread the original topic. I see now my method of testing it wouldn't work anyway!

Does any data end up in the SQL database at all from ingame?
Are you sure none of the player data being inserted contains null values?
Reply
#8

I used this under ongamemodeinit
Код:
mysql_global_options(DUPLICATE_CONNECTIONS, true);
and the duplicate warning is gone.

When the player registers it saves the first 6 rows in the table i showed, and they're right.

but when i get in game and change level/kills/deaths it doesnt save.

I connect from a filterscript and the gamemode.
Reply
#9

Try temporarily allowing nulls in the columns and see what happens? If when you leave the game and check the DB you see a null value set in one of the columns - there's your problem.
Reply
#10

No difference :/
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)