problem in loading data [MYSQL]
#1

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
Reply
#2

help me plz,
Reply
#3

note: use %e instead of %s in the query... to avoid SQL injection
Reply
#4

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.
Reply
#5

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
Reply
#6

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.
Reply
#7

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 ?
Reply
#8

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
Reply
#9

MY problem not that , my problem its is not loading data from databse to variable
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)