SA-MP Forums Archive
MySQL Query Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL Query Problem (/showthread.php?tid=631911)



MySQL Query Problem - Banditul18 - 06.04.2017

Hello i have a problem about a query, i know it's mysql_query but i need the result "instant"

PHP код:
new Cache:csalt,squery[128];
    
mysql_format(SQLsquerysizeof(squery), "SELECT `salt` FROM `users` WHERE `name` = '%e'"GetName(playerid));
    
csalt mysql_query(SQLsquery);
    if(
cache_num_rows() > 0)
    {
        
cache_get_field_content(0"salt"PlayerInfo[playerid][pSalt], SQL);
    }
    
cache_delete(csaltSQL);
    
format(squerysizeof(squery), "Salt: %s",PlayerInfo[playerid][pSalt]);
    print(
squery); 
I try to get the salt from database , but always return as a empty string adn the login system not working becasue there is no salt , how to make this query work?


Re: MySQL Query Problem - BroZeus - 06.04.2017

If you store the string in enum you need to provide max length of string yourself.
Use this :
Quote:

cache_get_field_content(0, "salt", PlayerInfo[playerid][pSalt], SQL, 256);

Change 256 to whatever max length of salt is, then it should work.


Re: MySQL Query Problem - Banditul18 - 06.04.2017

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
If you store the string in enum you need to provide max length of string yourself.
Use this :

Change 256 to whatever max length of salt is, then it should work.
That i do not know it about provide size for enum arrays, thank you for tell me this, much appreciate