Mysql help
#1

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);
}
Reply
#2

up everybody know?
Reply
#3

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

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

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

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"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)