SAMP MYSQL help please
#1

Код:
[00:33:03] UPDATE `families` SET `Taken`=1, `Name`='', `Leader`='', `Bank`=0, `Cash`=0, `FamilyUSafe`=0, `FamilySafeX`=0.000000, `FamilySafeY`=0.000000, `FamilySafeZ`=0.000000, `FamilySafeVW`=0, `FamilySafeInt`=0, `Pot`=0, `Crack`=0, `Mats`=0, `Heroin`=0, `Rank0`='Newb', `Rank1`='Outsider', `Rank2`='Associate', `Rank3`='Soldier', `Rank4`='Capo', `Rank5`='Underboss', `Rank6`='Godfather', `Division0`='None', `Division1`='None', `Division2`='None', `Division3`='None', `Division4`='None', `fontface`='Arial', `fontsize`=24, `bold`=0, `fontcolor`=-1, `gtUsed`=1, `text`='Preview',  `MaxSkins`=0, `Skin1`=1490, `Skin2`=0, `Skin3`=0, `Skin4`=0, `Skin5`=2, `Skin6`=, `Skin7`=, `Skin8`=, `Color`=, `TurfTokens`=, `Gun1`=, `Gun2`=, `Gun3`=, `Gun4`=, `Gun5`=, `Gun6`=, `Gun7`=, `Gun8`=, `Gun9`=, `Gun10`=, `GtObject`=, `MOTD1`='', `MOTD2`='', `MOTD3`='' WHERE `ID` = 
[00:33:03] [MySQL] Query Error - (ErrorID: 1064) (Handle: 1)
[00:33:03] [MySQL] Check mysql_log.txt to review the query that threw the error.
[00:33:03] Dumping query from 2014/1/19 (0:33:3)

Description: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' `Skin7`=, `Skin8`=, `Color`=, `TurfTokens`=, `Gun1`=, `Gun2`=, `Gun3`=, `Gun4`=' at line 1 (index 0). Query:
I don't know whats wrong but this error is being thrown.

My Pawno
pawn Код:
stock SaveFamily(id) {

    new string[3048];

    format(string, sizeof(string), "UPDATE `families` SET \
        `Taken`=%d, \
        `Name`='%s', \
        `Leader`='%s', \
        `Bank`=%d, \
        `Cash`=%d, \
        `FamilyUSafe`=%d, \
        `FamilySafeX`=%f, \
        `FamilySafeY`=%f, \
        `FamilySafeZ`=%f, \
        `FamilySafeVW`=%d, \
        `FamilySafeInt`=%d, \
        `Pot`=%d, \
        `Crack`=%d, \
        `Mats`=%d, \
        `Heroin`=%d, \
        `Rank0`='%s', \
        `Rank1`='%s', \
        `Rank2`='%s', \
        `Rank3`='%s', \
        `Rank4`='%s', \
        `Rank5`='%s', \
        `Rank6`='%s', \
        `Division0`='%s', \
        `Division1`='%s', \
        `Division2`='%s', \
        `Division3`='%s', \
        `Division4`='%s', "
,
        FamilyInfo[id][FamilyTaken],
        g_mysql_ReturnEscaped(FamilyInfo[id][FamilyName], MainPipeline),
        FamilyInfo[id][FamilyLeader],
        FamilyInfo[id][FamilyBank],
        FamilyInfo[id][FamilyCash],
        FamilyInfo[id][FamilyUSafe],
        FamilyInfo[id][FamilySafe][0],
        FamilyInfo[id][FamilySafe][1],
        FamilyInfo[id][FamilySafe][2],
        FamilyInfo[id][FamilySafeVW],
        FamilyInfo[id][FamilySafeInt],
        FamilyInfo[id][FamilyPot],
        FamilyInfo[id][FamilyCrack],
        FamilyInfo[id][FamilyMats],
        FamilyInfo[id][FamilyHeroin],
        g_mysql_ReturnEscaped(FamilyRankInfo[id][0], MainPipeline),
        g_mysql_ReturnEscaped(FamilyRankInfo[id][1], MainPipeline),
        g_mysql_ReturnEscaped(FamilyRankInfo[id][2], MainPipeline),
        g_mysql_ReturnEscaped(FamilyRankInfo[id][3], MainPipeline),
        g_mysql_ReturnEscaped(FamilyRankInfo[id][4], MainPipeline),
        g_mysql_ReturnEscaped(FamilyRankInfo[id][5], MainPipeline),
        g_mysql_ReturnEscaped(FamilyRankInfo[id][6], MainPipeline),
        g_mysql_ReturnEscaped(FamilyDivisionInfo[id][0], MainPipeline),
        g_mysql_ReturnEscaped(FamilyDivisionInfo[id][1], MainPipeline),
        g_mysql_ReturnEscaped(FamilyDivisionInfo[id][2], MainPipeline),
        g_mysql_ReturnEscaped(FamilyDivisionInfo[id][3], MainPipeline),
        g_mysql_ReturnEscaped(FamilyDivisionInfo[id][4], MainPipeline)
    );

    format(string, sizeof(string), "%s\
        `fontface`='%s', \
        `fontsize`=%d, \
        `bold`=%d, \
        `fontcolor`=%d, \
        `gtUsed`=%d, \
        `text`='%s', "
,
        string,
        FamilyInfo[id][gt_FontFace],
        FamilyInfo[id][gt_FontSize],
        FamilyInfo[id][gt_Bold],
        FamilyInfo[id][gt_FontColor],
        FamilyInfo[id][gt_SPUsed],
        g_mysql_ReturnEscaped(FamilyInfo[id][gt_Text], MainPipeline)
    );

    format(string, sizeof(string), "%s \
        `MaxSkins`=%d, \
        `Skin1`=%d, \
        `Skin2`=%d, \
        `Skin3`=%d, \
        `Skin4`=%d, \
        `Skin5`=%d, \
        `Skin6`=%d, \
        `Skin7`=%d, \
        `Skin8`=%d, \
        `Color`=%d, \
        `TurfTokens`=%d, \
        `Gun1`=%d, \
        `Gun2`=%d, \
        `Gun3`=%d, \
        `Gun4`=%d, \
        `Gun5`=%d, \
        `Gun6`=%d, \
        `Gun7`=%d, \
        `Gun8`=%d, \
        `Gun9`=%d, \
        `Gun10`=%d, \
        `GtObject`=%d, \
        `MOTD1`='%s', \
        `MOTD2`='%s', \
        `MOTD3`='%s' \
        WHERE `ID` = %d"
,
        string,
        FamilyInfo[id][FamilyMaxSkins],
        FamilyInfo[id][gtObject],
        g_mysql_ReturnEscaped(FamilyMOTD[id][0], MainPipeline),
        g_mysql_ReturnEscaped(FamilyMOTD[id][1], MainPipeline),
        g_mysql_ReturnEscaped(FamilyMOTD[id][2], MainPipeline),
        id
    );

    mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);

    return 1;
}
pawn Код:
forward OnLoadFamilies();
public OnLoadFamilies()
{
    new i, rows, fields, tmp[128], famid;
    cache_get_data(rows, fields, MainPipeline);

    new column[32];
    while(i < rows)
    {
        FamilyMemberCount(i);
        cache_get_field_content(i, "ID", tmp, MainPipeline); famid = strval(tmp);
        cache_get_field_content(i, "Taken", tmp, MainPipeline); FamilyInfo[famid][FamilyTaken] = strval(tmp);
        cache_get_field_content(i, "fontface", tmp, MainPipeline); format(FamilyInfo[famid][gt_FontFace], 32, "%s", tmp);
        cache_get_field_content(i, "fontsize", tmp, MainPipeline); FamilyInfo[famid][gt_FontSize] = strval(tmp);
        cache_get_field_content(i, "bold", tmp, MainPipeline); FamilyInfo[famid][gt_Bold] = strval(tmp);
        cache_get_field_content(i, "fontcolor", tmp, MainPipeline); FamilyInfo[famid][gt_FontColor] = strval(tmp);
        cache_get_field_content(i, "text", FamilyInfo[famid][gt_Text], MainPipeline, 32);      
        cache_get_field_content(i, "gtUsed", tmp, MainPipeline); FamilyInfo[famid][gt_SPUsed] = strval(tmp);       
        if(strcmp(FamilyInfo[famid][gt_Text], "Preview", true) == 0)
        {
            FamilyInfo[famid][gtObject] = 1490;
            FamilyInfo[famid][gt_SPUsed] = 1;
        }
        for (new j; j <= 6; j++) {
            format(column,sizeof(column), "Rank%d", j);
            cache_get_field_content(i, column, tmp, MainPipeline); format(FamilyRankInfo[famid][j], 20, "%s", tmp);
        }

        for (new j = 0; j < 5 ;j++) {
            format(column, sizeof(column), "Division%d", j);
            cache_get_field_content(i, column, tmp, MainPipeline); format(FamilyDivisionInfo[famid][j], 20, "%s", tmp);
        }
        for (new j; j < 8; j++) {
            format(column,sizeof(column), "Skin%d", j+1);
            cache_get_field_content(i, column, tmp, MainPipeline); FamilyInfo[famid][FamilySkins][j] = strval(tmp);
        }
        for (new j; j < 10; j++) {
            format(column,sizeof(column), "Gun%d", j+1);
            cache_get_field_content(i, column, tmp, MainPipeline); FamilyInfo[famid][FamilyGuns][j] = strval(tmp);
        }
        if(FamilyInfo[famid][FamilyUSafe] > 0)
        {
            FamilyInfo[famid][FamilyPickup] = CreateDynamicPickup(1239, 23, FamilyInfo[famid][FamilySafe][0], FamilyInfo[famid][FamilySafe][1], FamilyInfo[famid][FamilySafe][2], .worldid = FamilyInfo[famid][FamilySafeVW], .interiorid = FamilyInfo[famid][FamilySafeInt]);
        }
        if(FamilyInfo[famid][FamilyEntrance][0] != 0.0 && FamilyInfo[famid][FamilyEntrance][1] != 0.0)
        {
            new string[42];
            FamilyInfo[famid][FamilyEntrancePickup] = CreateDynamicPickup(1318, 23, FamilyInfo[famid][FamilyEntrance][0], FamilyInfo[famid][FamilyEntrance][1], FamilyInfo[famid][FamilyEntrance][2]);
            format(string, sizeof(string), "%s", FamilyInfo[famid][FamilyName]);
            FamilyInfo[famid][FamilyEntranceText] = CreateDynamic3DTextLabel(string,COLOR_YELLOW,FamilyInfo[famid][FamilyEntrance][0], FamilyInfo[famid][FamilyEntrance][1], FamilyInfo[famid][FamilyEntrance][2]+0.6,4.0);
        }
        i++;
    }
    //LoadGangTags();
}
If anyone can help with this, i'll be really amazed and appreciated , thanks guys
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)