SA-MP Forums Archive
[HELP] MySQL Loading Issue - 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: [HELP] MySQL Loading Issue (/showthread.php?tid=606707)



[HELP] MySQL Loading Issue - BornHuman - 07.05.2016

So I'm converting a group system into MySQL, and I have this function (that is calling correctly, I have checked that.)

pawn Код:
public InitiateGroups()
{

    new rows, row, fields, number[25];
   
    cache_get_data(rows, fields);
    while(row < rows)
    {        
        cache_get_field_content_int(row, "GroupType", Group[row][GroupType]);
        cache_get_field_content(row, "GroupName", Group[row][GroupName], 256);
        cache_get_field_content(row, "MOTD", Group[row][GroupMOTD], 256);

        for(new i = 0; i != MAX_GROUP_RANKS; ++i)
        {
            format(number, sizeof number, "Rank%i", i);
            cache_get_field_content(row, number, GroupRankNames[row][i], 256);
        }
        for(new i = 0; i != MAX_GROUP_RANKS; ++i)
        {
            format(number, sizeof number, "RankPay%i", i);
            cache_get_field_content_int(row, number, Group[row][GroupPaycheque][i]);
        }
        for(new i = 0; i != 6; ++i)
        {
            format(number, sizeof number, "Div%i", i);
            cache_get_field_content(row, number, GroupDivisionNames[row][i], 256);
        }
        row++;
    }
    switch(row)
    {
        case 0: printf("[SCRIPT-LOAD/ERR] The script initiated 0 groups.", row);
        default: printf("[SCRIPT-LOAD] The script has initiated %d groups", row);
    }
}
The issue is, it is not loading the GroupName, at least it isn't when I display the group dialog. It won't show up and I have to set it again. I checked the database and it saves in there, which means I believe it to be a loading issue.

Any thoughts? (REP+)


Re: [HELP] MySQL Loading Issue - Jack_Leslie - 08.05.2016

I've had this problem also. I found that loading it into a temp string then formatting the value from the temp string works. Like this:
pawn Код:
cache_get_field_content(i, "owner", temp_string);
        format(businessData[i][bowner], 128, "%s", temp_string);



Re: [HELP] MySQL Loading Issue - BornHuman - 15.05.2016

Quote:
Originally Posted by Jack_Leslie
Посмотреть сообщение
I've had this problem also. I found that loading it into a temp string then formatting the value from the temp string works. Like this:
pawn Код:
cache_get_field_content(i, "owner", temp_string);
        format(businessData[i][bowner], 128, "%s", temp_string);
I had to complete the parameters with the connection handle and the string length before it would work. Odd, isn't it? Thank you though.


Re: [HELP] MySQL Loading Issue - zPain - 15.05.2016

PHP код:
cache_get_field_content(row"GroupName"Group[row][GroupName], connectionHandle256);