need help with mysql
#1

hello, i'm new in mysql so i dont know how to load player position, saving is good but loading is bad, it loads player in too vilages (0 cordinates) if someone can help me it woud be nice
this is my saving:

Код:
GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
				format(query, sizeof(query), "UPDATE `Vartotojai` SET `X` = '%f', `Y` = '%f', `Z` = '%f' WHERE (`Vardas` = '%s')",pPos[0], pPos[1], pPos[2],pName);
				mysql_query(query);
and this is loading:
Код:
new Float:pos[3];
		mysql_fetch_field_row(Query,"X");
		pos[0] = floatstr(Query);
		mysql_fetch_field_row(Query,"Y");
		pos[1] = floatstr(Query);
		mysql_fetch_field_row(Query,"Z");
		pos[2] = floatstr(Query);
		SetPlayerPos(playerid,pos[0],pos[1],pos[2]);
loading isint working saving is good the cordinates is saved.

P.S. sorry for my bad english
Reply
#2

Hello, you can not fetch the row like that you will have to make a new query for getting the data from the mysql database.

For that you will have to make a new query:

pawn Код:
format(musicquery,sizeof(musicquery),"SELECT `url` FROM `playlist` WHERE `music` LIKE '%s%s%s'", "%%", musicname, "%%"); // SELECT is to select the data of URL (URL is a Column) FROM "playlist" (playlist is a table name) then WHERE? music (it's a column) LIKE %name%s
mysql_query(musicquery)
It should be something like this, since I don't know what are your table and column names so I can not make a query for you. But the above query is just an example to "select" data from the database.

For more info click the following link for the tutorial of MySQL:-

https://sampforum.blast.hk/showthread.php?tid=129183
-FalconX
Reply
#3

Quote:

stock Uzkraunam(playerid)
{
new Query[65];
if(!IsPlayerConnected(playerid)) return 1;
format(Query, sizeof(Query), "SELECT * FROM `Vartotojai` WHERE `Vardas` = '%s'", GetPlayerNameEx( playerid ));
mysql_query(Query); mysql_store_result();


new Floatos[3];
mysql_fetch_field_row(Query,"X");
pos[0] = floatstr(Query);
mysql_fetch_field_row(Query,"Y");
pos[1] = floatstr(Query);
mysql_fetch_field_row(Query,"Z");
pos[2] = floatstr(Query);
SetPlayerPos(playerid,pos[0],pos[1],pos[2]);

hear is my tables
Reply
#4

sorry for DP but can someone help me
Reply
#5

is that on linux server, if it is use crashdetect plugin, I believe its the mysql_fetch_field_row that is not working
Reply
#6

its not on linux, the other things like money or XP it laods good
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)