SA-MP Forums Archive
MySQL get rows problem - 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 get rows problem (/showthread.php?tid=665139)



MySQL get rows problem - xRadical3 - 23.03.2019

pawn Code:
stock GetClanMembers(clan[])
{
    new minfo[3*550], mreturn[386], string[386], clanquery[160], count;
    format(clanquery, sizeof(clanquery), "SELECT * FROM members WHERE clanname = '%s'", clan);
    mysql_query(1,clanquery);
    mysql_store_result();
    while(mysql_fetch_row_format(clanquery,"|"))
    {
        count++;
        mysql_fetch_field_row(string,"playername");
        format(minfo,sizeof(minfo),"{FA5882}%i. {FFFF90}Name: {375FFF}%s {FFFF90}Rank: {375FFF}%s (%i) {FFFFFF}Stats: %s\n",count, string, GetClanRankName(clan, GetPlayerClanRankEx(string)),GetPlayerClanRankEx(string), (!IsPlayerOnline(string)?("{00FF00}Online"):("{FF0000}Offline")) );
        strcat(mreturn, minfo);
    }
    mysql_free_result();
    return mreturn;
}

CMD:cmembers(playerid, params[])
{
    LoginCheck(playerid);
    if(IsPlayerAnyClanMember(playerid))
    {
    Dialog_Show(playerid, DialogUnused, DIALOG_STYLE_MSGBOX, "Afrade Clan", "{FA5882}%s", "Ok","" ,GetClanMembers(GetPlayerClan(playerid)));
    } else return Error(playerid, "Dastersi Nadarid.");
    return true;
}
Problem:
Just get one row and show on the dialog.
How to fix this??


Re: MySQL get rows problem - NoteND - 23.03.2019

Change

PHP Code:
format(minfo,sizeof(minfo),"{FA5882}%i. {FFFF90}Name: {375FFF}%s {FFFF90}Rank: {375FFF}%s (%i) {FFFFFF}Stats: %s\n",countstringGetClanRankName(clanGetPlayerClanRankEx(string)),GetPlayerClanRankEx(string), (!IsPlayerOnline(string)?("{00FF00}Online"):("{FF0000}Offline")) ); 
to

PHP Code:
format(minfo,sizeof(minfo),"%s\n{FA5882}%i. {FFFF90}Name: {375FFF}%s {FFFF90}Rank: {375FFF}%s (%i) {FFFFFF}Stats: %s\n",minfocountstringGetClanRankName(clanGetPlayerClanRankEx(string)),GetPlayerClanRankEx(string), (!IsPlayerOnline(string)?("{00FF00}Online"):("{FF0000}Offline")) ); 



Re: MySQL get rows problem - xRadical3 - 24.03.2019

Quote:
Originally Posted by NoteND
View Post
Change

PHP Code:
format(minfo,sizeof(minfo),"{FA5882}%i. {FFFF90}Name: {375FFF}%s {FFFF90}Rank: {375FFF}%s (%i) {FFFFFF}Stats: %s\n",countstringGetClanRankName(clanGetPlayerClanRankEx(string)),GetPlayerClanRankEx(string), (!IsPlayerOnline(string)?("{00FF00}Online"):("{FF0000}Offline")) ); 
to

PHP Code:
format(minfo,sizeof(minfo),"%s\n{FA5882}%i. {FFFF90}Name: {375FFF}%s {FFFF90}Rank: {375FFF}%s (%i) {FFFFFF}Stats: %s\n",minfocountstringGetClanRankName(clanGetPlayerClanRankEx(string)),GetPlayerClanRankEx(string), (!IsPlayerOnline(string)?("{00FF00}Online"):("{FF0000}Offline")) ); 
not working..
Still get one row.


Re: MySQL get rows problem - xRadical3 - 25.03.2019

bump

EDIT:
I find problem:
Code:
stock GetPlayerClanRankEx(playername[])
{
	new rank[10];
	new clanquery[100];
	format(clanquery, sizeof(clanquery), "SELECT playerclanrank FROM members WHERE playername = '%s'", playername);
	mysql_query(1,clanquery);
	mysql_store_result();
	mysql_fetch_row(rank);
	mysql_free_result();
	return strval(rank);
}
How to fix ?