MySQL Retrieve field
#1

I have a database with 10 rows and 30 fields. I want to go on each row, and to get the fieldName 'pName' and to print it. Is there any efficient function rather that this?

Код:
	mysql_query("SELECT `pName` FROM `database`");
	mysql_store_result();

	new registeredPlayers = mysql_num_rows();

	if(registeredPlayers)
	{
		new pName[MAX_PLAYER_NAME];
		while(mysql_retrieve_row())
		{
			mysql_get_field("playerName", pName);
			printf("%s", pName);
		}
	}

	mysql_free_result();

	printf("Total registered players: %d", registeredPlayers);
Reply
#2

Quote:
Originally Posted by saamp
Посмотреть сообщение
I have a database with 10 rows and 30 fields. I want to go on each row, and to get the fieldName 'pName' and to print it. Is there any efficient function rather that this?

Код:
	mysql_query("SELECT `pName` FROM `database`");
	mysql_store_result();

	new registeredPlayers = mysql_num_rows();

	if(registeredPlayers)
	{
		new pName[MAX_PLAYER_NAME];
		while(mysql_retrieve_row())
		{
			mysql_get_field("playerName", pName);
			printf("%s", pName);
		}
	}

	mysql_free_result();

	printf("Total registered players: %d", registeredPlayers);
Use the latest MySQL plugin? Threaded queries are a lot more efficient.
Reply
#3

Quote:
Originally Posted by Sinner
Посмотреть сообщение
Use the latest MySQL plugin? Threaded queries are a lot more efficient.
Yes, I think! Could you show me an example?
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=337810
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)