MySQL Admin Forum Name system not saving/loading
#1

The title basically explains it. It won't work out probably.

pawn Код:
mysql_fetch_field_row(savingstring, "aforumname"); strmid(Player[playerid][aForumName], savingstring, 0, strlen(savingstring), 50);

            format(query, sizeof(query), "UPDATE accounts SET adminlevel=%d AND aforumname=%s WHERE id=%d LIMIT 1",
            Player[playerid][AdminLevel],
            Player[playerid][aForumName],
            Player[playerid][AccountID]);
            mysql_query(query);
enum PlayerDataEnum
    {
aforumname[50]
}

CMD:setaforumname(playerid, params[])
    {
        new string[128], string1[128], namestring[32], id;
        if(Player[playerid][AdminLevel] >= 1)
        {
            if(sscanf(params, "us[50]", id, namestring)) return SCM(playerid, GREY, "Usage: /setaforumname [playerid][newname]");
            {
                if(id != INVALID_PLAYER_ID)
                {
                    if(Player[id][AdminLevel] != 0)
                    {
                        strmid(Player[id][aForumName], namestring, 0, strlen(namestring), 255);
                       
                        new query[128];
                       
                        format(string1, sizeof(string), "You have set %s's (ID: %d) ingame forum name to {FFFF00}%s", RemoveUnderScore(id), id, namestring);
                        format(string, sizeof(string), "Administrator %s (ID: %d) has set your ingame forum name to %s", RemoveUnderScore(playerid), playerid, namestring);
                       
                        mysql_query(query);
                       
                        SendClientMessage(playerid, WHITE, string1);
                        SendClientMessage(id, WHITE, string);
                        SaveStats(id);
                    }
                    else return SCM(playerid, GREY, "This player is not an administrator.");
                }
                else return SCM(playerid, GREY, NotConnected);
            }
        }
        else return SendClientMessage(playerid, GREY, AdminOnly);
        return 1;
    }
I tried to change it to Player[i][aForumName] = namestring; But it didn't work, errors.
Reply
#2

In the debug, it says that the SQL query was incorrect.
Reply
#3

pawn Код:
mysql_fetch_field_row(savingstring, "aforumname"); strmid(Player[playerid][aForumName], savingstring, 0, strlen(savingstring), 50);

            format(query, sizeof(query), "UPDATE accounts SET `adminlevel`=%d, `aforumname`=%s WHERE `id`=%d LIMIT 1",
            Player[playerid][AdminLevel],
            Player[playerid][aForumName],
            Player[playerid][AccountID]);
            mysql_query(query);
Try this.
Reply
#4

Still not loading or saving.
Reply
#5

Can you show us the whole of your SaveStats function please.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)