MySQL loads random values
#1

So I have a problem with my mysql data loading.
I want it to load the stuff from my database, but it loads some random values.
I checked, if there was a typo in the field idx, but there was not - those values, that it loaded were not even in my mysql database.

Here's the code
Код:
format(query, sizeof(query), "SELECT * FROM `players` WHERE `name` = '%s'", playerName(playerid));
	mysql_function_query(g_Handle, query, true, "LoadAcc", "d", playerid);
LoadAcc
Код:
	PlayerInfo[playerid][kSQLID]			= cache_get_row_int(0, 0, g_Handle),
	PlayerInfo[playerid][kAdmin]			= cache_get_row_int(0, 3, g_Handle),
	PlayerInfo[playerid][kBanned]			= cache_get_row_int(0, 5, g_Handle),
	PlayerInfo[playerid][kLang]			= cache_get_row_int(0, 6, g_Handle),
	PlayerInfo[playerid][kWarn]	         	= cache_get_row_int(0, 7, g_Handle),
	PlayerInfo[playerid][kMoney]			= cache_get_row_int(0, 9, g_Handle),
	PlayerInfo[playerid][kSkin]			= cache_get_row_int(0, 10, g_Handle),
	PlayerInfo[playerid][kScore]			= cache_get_row_int(0, 13, g_Handle);

	cache_get_row(0, 1, PlayerInfo[playerid][kName], g_Handle, 70);
	cache_get_row(0, 2, PlayerInfo[playerid][kPW], g_Handle, 130);
	cache_get_row(0, 14, PlayerInfo[playerid][kSalt], g_Handle, 31);
Reply
#2

What values loaded?
Reply
#3

Debug shows these values
Код:
[16:23:33] 6 - SQLID - correct
[16:23:33] 0 - ADMINLEVEL (in db 2014)
[16:23:33] 0 - BANNED - correct
[16:23:33] 0 - LANG - correct
[16:23:33] 0 - WARNS - correct
[16:23:33] 105 - MONEY (in db 15000)
[16:23:33] 102 - SKIN  - correct
[16:23:33] 99 - SCORE (in db 123)
Reply
#4

did you check if the wrong field is selected.
Reply
#5

Yes.
And those values, that it loaded were not even in my mysql database.
Reply
#6

Then your error is somewhere else in your code, because everything here looks good.

Just replace this:
g_Handle),

With:
g_Handle);

Don't use a ,
Reply
#7

Quote:
Originally Posted by Dotayuri
Посмотреть сообщение
Then your error is somewhere else in your code, because everything here looks good.

Just replace this:
g_Handle),

With:
g_Handle);

Don't use a ,
I don't know the problem myself, although that isn't it. That's general Syntax. Instead of writing for example.

Dog = 1;
Cat = 2;

It just reads as one line like Dog = 1, Cat = 2;

Both are correct and valid, don't change your syntax. Enters, or returns are acceptable between this "line" aswell.
Reply
#8

Quote:
Originally Posted by IceCube!
Посмотреть сообщение
I don't know the problem myself, although that isn't it. That's general Syntax. Instead of writing for example.

Dog = 1;
Cat = 2;

It just reads as one line like Dog = 1, Cat = 2;

Both are correct and valid, don't change your syntax. Enters, or returns are acceptable between this "line" aswell.
I know. Its just well it wouldn't hurt to just test it.
It also couldn't help I guess.

I'm going to bed sorry I couldn't help
Try posting a little more code, just the wrong ones I guess

PHP код:
PlayerInfo[playerid][kScore]            = cache_get_row_int(013g_Handle); 
What do you do with(PlayerInfo[playerid][kScore]) after you get_row?

In my mind(if you're not having any trouble loading a variable) you got like 5 correct
maybe you're having trouble displaying it.
Reply
#9

Okay, well, I did some more debugging and found out, that everything is okay with mysql.

This prints the correct values
Код:
	printf("%d - ADMIN_CACHE", cache_get_row_int(0, 3, g_Handle));
	printf("%d - SKIN_CACHE", cache_get_row_int(0, 10, g_Handle));
	printf("%d - SCORE_CACHE", cache_get_row_int(0, 13, g_Handle));
and the mysql_log file shows, that the values loaded by mysql are indeed correct.

So something must be wrong here.

Код:
	PlayerInfo[playerid][kSQLID]			= cache_get_row_int(0, 0, g_Handle),
	PlayerInfo[playerid][kAdmin]			= cache_get_row_int(0, 3, g_Handle),
	PlayerInfo[playerid][kBanned]			= cache_get_row_int(0, 5, g_Handle),
	PlayerInfo[playerid][kLang]			= cache_get_row_int(0, 6, g_Handle),
	PlayerInfo[playerid][kWarn]	         	= cache_get_row_int(0, 7, g_Handle),
	PlayerInfo[playerid][kMoney]			= cache_get_row_int(0, 9, g_Handle),
	PlayerInfo[playerid][kSkin]			= cache_get_row_int(0, 10, g_Handle),
	PlayerInfo[playerid][kScore]			= cache_get_row_int(0, 13, g_Handle);


	cache_get_row(0, 1, PlayerInfo[playerid][kName], g_Handle, 70);
	cache_get_row(0, 2, PlayerInfo[playerid][kPW], g_Handle, 130);
	cache_get_row(0, 14, PlayerInfo[playerid][kSalt], g_Handle, 31);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)