PDA

View Full Version : [HELP] MySQL Loading Issue


BornHuman
07/05/2016, 10:20 PM
So I'm converting a group system into MySQL, and I have this function (that is calling correctly, I have checked that.)

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+)

Jack_Leslie
08/05/2016, 02:05 AM
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:

cache_get_field_content(i, "owner", temp_string);
format(businessData[i][bowner], 128, "%s", temp_string);

BornHuman
15/05/2016, 07:47 AM
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:

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.

zPain
15/05/2016, 07:56 AM
cache_get_field_content(row, "GroupName", Group[row][GroupName], connectionHandle, 256);