problem in loading data [MYSQL] -
HoussemGaming - 24.06.2017
Hi, i'm creating a vip system for my gm.
So i created the script, i set myself vip for testing.
when i try use /vcar after i restart the server it says you are not allowed to use this command.
the loading data code :
Код:
public OnPlayerConnect(playerid)
{
new query[256],level[3],pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, 24);
format(query, sizeof(query), "SELECT viplevel FROM users WHERE username = '%s'", pname);
mysql_query(query);
mysql_store_result();
new rows = mysql_num_rows();
if(!rows)
{
SCM(playerid, BLUE, "Welcome, Your stats has been loaded");
}
if(rows == 1)
{
SCM(playerid, BLUE, "Welcome, Your VIP level and your stats has been loaded");
mysql_fetch_field_row(level, "viplevel");
VipInfo[playerid][VIP] = strval(level);
}
mysql_free_result();
return 1;
}
I wanna load the vip level on the variable
Re: problem in loading data [MYSQL] -
HoussemGaming - 24.06.2017
help me plz,
Re: problem in loading data [MYSQL] -
AndreiWow - 24.06.2017
note: use %e instead of %s in the query... to avoid SQL injection
Re: problem in loading data [MYSQL] -
GoldenLion - 25.06.2017
Quote:
Originally Posted by AndreiWow
note: use %e instead of %s in the query... to avoid SQL injection
|
That's not necessary as you can't put apostrophes in your name and for the regular format it's %q.
About the issue, I can't help you with it because I don't know how to use the old MySQL so my advice is to get the latest version.
Re: problem in loading data [MYSQL] -
HoussemGaming - 25.06.2017
Quote:
Originally Posted by GoldenLion
That's not necessary as you can't put apostrophes in your name and for the regular format it's %q.
About the issue, I can't help you with it because I don't know how to use the old MySQL so my advice is to get the latest version.
|
I have the latest version of BlueG mysql plugin
Re: problem in loading data [MYSQL] -
GoldenLion - 25.06.2017
Quote:
Originally Posted by HoussemGaming
I have the latest version of BlueG mysql plugin
|
R41-2 is the latest version. I assume you downloaded an old version from the bottom of the thread. Newest is on GitHub.
Re: problem in loading data [MYSQL] -
HoussemGaming - 25.06.2017
Tell me link of new one
EDIT : i update the plugin, now should what i do, use cashe functions instead of mysql_fetch_field_row ?
Re: problem in loading data [MYSQL] -
GoldenLion - 25.06.2017
Quote:
Originally Posted by HoussemGaming
Tell me link of new one
EDIT : i update the plugin, now should what i do, use cashe functions instead of mysql_fetch_field_row ?
|
You can find everything with examples here:
https://sampwiki.blast.hk/wiki/MySQL/R40
Re: problem in loading data [MYSQL] -
HoussemGaming - 25.06.2017
MY problem not that , my problem its is not loading data from databse to variable