SA-MP Forums Archive
Mysql help - 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 help (/showthread.php?tid=577674)



Mysql help - zeth98 - 13.06.2015

Hello i want to make this command,
To show me the name of player who have "Leader" = 2
But not working i don't know very good mysql,

Код:
	if(strcmp(cmd, "/leader2", true) == 0)
	{
mysql_query("SELECT NULL FROM players WHERE Leader=2");
		mysql_store_result();
		mysql_free_result();
		new result[50];
		mysql_fetch_field_row(result,"username");
	    format(string, sizeof(string), " %s Leader 2",result);
		SendClientMessage(playerid,-1,string);
}



Re: Mysql help - zeth98 - 13.06.2015

up everybody know?


Re: Mysql help - Konstantinos - 13.06.2015

https://sampwiki.blast.hk/wiki/MySQL#mysql_retrieve_row


Re: Mysql help - zeth98 - 13.06.2015

i don't understand, how can take the name of player that command?


Re: Mysql help - Konstantinos - 13.06.2015

You should select the player's name (the field of it and not NULL) and then as there might be more than 1 row, you use the loop with the function I linked above and then mysql_fetch_field_row to get the data.

Though the version of the plugin plugin you use is very outdated, it's better to learn how to use threaded queries and update to R39-3.


Re: Mysql help - zeth98 - 13.06.2015

But i have mysql r5 i can't update because i don't know how
And give many error
error 017: undefined symbol "mysql_store_result"
error 017: undefined symbol "mysql_free_result"
error 017: undefined symbol "mysql_ping"
error 017: undefined symbol "mysql_fetch_row"
error 017: undefined symbol "mysql_retrieve_row"
error 017: undefined symbol "mysql_fetch_field_row"