Problem with obtaining information from my database
#1

Hello,

I'm using a MySQL plugin, R41-4 to be precise.

I make a tquery and within the callback I use "cache_get_value_name(0, "Password", pInfo[playerid][Password]);"

Now, I checked and the value returned is null. I have no value whatsoever there.
The logs say:

[17:36:14] [DEBUG] cache_get_value_name(0, "Password", 0x04CA62DC, 1)
[17:36:14] [DEBUG] cache_get_value_name: assigned value: 'censored'
[17:36:14] [DEBUG] cache_get_value_name: return value: '1'

and replace censored with my actual password.

It seems to get the value properly, just not insert it into my string. Any thoughts on what I might be doing wrong?

Thank you in advance,
Denying
Reply
#2

What about showing code?
Reply
#3

0x04CA62DC, you should replace that color with your variable lol
Reply
#4

Here's the code in question:

OnPlayerConnect:

Код:
mysql_format(mysql, query, sizeof(query), "SELECT `Password`, `ID` FROM `Users` WHERE `Username` = '%e' LIMIT 1", playerName);
mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);
OnAccountCheck:

Код:
new rows;
	
cache_get_row_count(rows);
	
if(rows)
{
    cache_get_value_name(0, "Password", pInfo[playerid][Password]);
    cache_get_value_name_int(0, "ID", pInfo[playerid][ID])
}
As you can see, I did not type a number (or address), rather, I typed a string.
Reply
#5

wiki: "Important Note: You have to provide the size (max_len) by yourself if you use an enum-array as destination."

https://sampwiki.blast.hk/wiki/MySQL/R40...get_value_name
Reply
#6

*facepalm*

I've been through the wiki over and over again trying to see what I am missing...

Anyway, thank you very much. +rep
Reply
#7

Try this and don't forget to change the length to match your needs.

cache_get_value_name(0, "Password", pInfo[playerid][Password], 130);

By the way, stealing passwords is disgusting.
Reply
#8

Quote:
Originally Posted by Denying
Посмотреть сообщение
Here's the code in question:

OnPlayerConnect:

Код:
mysql_format(mysql, query, sizeof(query), "SELECT `Password`, `ID` FROM `Users` WHERE `Username` = '%e' LIMIT 1", playerName);
mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);
OnAccountCheck:

Код:
new rows;
	
cache_get_row_count(rows);
	
if(rows)
{
    cache_get_value_name(0, "Password", pInfo[playerid][Password]);
    cache_get_value_name_int(0, "ID", pInfo[playerid][ID])
}
As you can see, I did not type a number (or address), rather, I typed a string.
do not need it OnAccountCheck
Код:
mysql_format(mysql, query, sizeof(query), "SELECT `Password`, `ID` FROM `Users` WHERE `Username` = '%e' LIMIT 1", playerName);
new Cache:result = mysql_query(mysql,query);
if(cache_num_rows() > 0) {
	cache_get_value_name(0, "Password", pInfo[playerid][Password]);
	cache_get_value_name_int(0, "ID", pInfo[playerid][ID])
}
cache_delete(result);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)