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



SQLite help - Danijel. - 16.03.2014

I want to get all the names and ranks form players in the database that are members of the same gang.

"CLAN" means member

i have written this code but its not working.

Код:
stock SviClanovi(playerid, idorg)
{
    new DBResult: Result, Field1[22], Field2[22], Query[350], string[256];
    
   	format(Query, sizeof(Query), "SELECT * FROM USERS WHERE CLAN = %d GROUP BY Name HAVING count(*) >= 1", idorg);
	Result = db_query(Database, Query);

	do
 	{
		db_get_field_assoc(Result, "NAME", Field1, 30);
		db_get_field_assoc(Result, "RANK", Field2, 30);
		format(string,sizeof(string) , "| %s  | %s", Field1, Field2);
		SCM(playerid, -1, string);

	}
	while(db_next_row(Result));

	
 	db_free_result(Result);
	return true;
}



Re: SQLite help - Danijel. - 16.03.2014

can someone help me?


Re: SQLite help - Danijel. - 16.03.2014

BUMP!


Re: SQLite help - Danijel. - 22.03.2014

Help?
Код:
stock SviClanovi(playerid, idorg)
{
    new DBResult: Result, Field1[24], Field2[24], Query[350], string[256];

   	format(Query, sizeof(Query), "SELECT * FROM USERS WHERE CLAN = %d", idorg);
	Result = db_query(Database, Query);
	new red = db_num_rows(Result);
	for(new i = 0; i < red; i++)
	{
		db_get_field_assoc(Result, "NAME", Field1, sizeof(Field1));
		db_get_field_assoc(Result, "RANK", Field2, sizeof(Field2));
		format(string,sizeof(string) , "| %s  | %s", Field1, Field2);
		SCM(playerid, -1, string);
	}
 	db_free_result(Result);
	return true;
}
i tried like this too but it is still not working