SA-MP Forums Archive
SQL - GetAllClans / GetTotalMembers - 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: SQL - GetAllClans / GetTotalMembers (/showthread.php?tid=356321)



SQL - GetAllClans / GetTotalMembers - nGen.SoNNy - 03.07.2012

Hi guys! I have some problems with my script! when i type /clans ... just first clan is showed in dialog and said Members: 0
Please help me! REP ++;



pawn Код:
stock GetTotalMembers( clan[ ] )
{
    new membersquery[ 256 ];
    format( membersquery, 256, "SELECT `members` FROM `clans` WHERE `clanname` = '%s'", clan );
    Result = db_query( Database, membersquery );
    new rows = db_num_rows( Result );
    db_free_result( Result );
    return ( rows );
}
stock GetAllClans()
{
    new clanquery[1024];
    new minfo[1024];
    format(clanquery, sizeof(clanquery), "SELECT `clanname` FROM `clans`");
    Result = db_query( Database, clanquery );
    for(new i;i<db_num_rows(Result);i++)
    {
        new string[30];
        db_get_field_assoc(Result, "clanname", string, 30);
        format(minfo,sizeof(minfo),"%s\n"W"ClanName: "G"%s\t"O"|\t"YE"Members: "G"%d" ,minfo, string, GetTotalMembers(string));
        db_next_row(Result);
    }
    db_free_result(Result);
    return minfo;
}



Re: SQL - GetAllClans / GetTotalMembers - nGen.SoNNy - 03.07.2012

Nobody can help me?


Re: SQL - GetAllClans / GetTotalMembers - nGen.SoNNy - 03.07.2012

UP


Respuesta: SQL - GetAllClans / GetTotalMembers - [DOG]irinel1996 - 03.07.2012

Use a loop to check all tables, and mysql_num_rows to get the number of fields.


Re: SQL - GetAllClans / GetTotalMembers - nGen.SoNNy - 03.07.2012

I;m using SQL
If you can edit my script i will rep++ and many thx


Re: SQL - GetAllClans / GetTotalMembers - [DOG]irinel1996 - 03.07.2012

Well.. I'm in my mobile phone right now, give me 30 minutes.
Romanian, hehe...