MYSQL auto table?
#1

I want to make this function make a table automatic, i expect it to do it by itself but it doesnt.
It gives me a error saying crystal.familystats isnt there or something

I want his to make a table auto.
pawn Код:
public LoadFamilyStats(familyid)
{
    format(UpdateQuery, 110, "SELECT * FROM `familystats` WHERE `ID`=%d LIMIT 1;", familyid+1);
    mysql_query(UpdateQuery);
    mysql_store_result();
    mysql_fetch_row(MySQLData, "|");
    splits(MySQLData, MySQLField, '|');
    mysql_free_result();
    FamilyInfo[familyid][fID] = strval(MySQLField[0]);
    format(FamilyInfo[familyid][fName], 31, "%s", MySQLField[1]);
    FamilyInfo[familyid][fMembers] = strval(MySQLField[2]);
    format(FamilyInfo[familyid][fCreator], MAX_PLAYER_NAME, "%s", MySQLField[3]);
    FamilyInfo[familyid][fBankingRank] = strval(MySQLField[4]);
    FamilyInfo[familyid][fClaimRank] = strval(MySQLField[5]);
    format(FamilyInfo[familyid][fRank1], 21, "%s", MySQLField[6]);
    format(FamilyInfo[familyid][fRank2], 21, "%s", MySQLField[7]);
    format(FamilyInfo[familyid][fRank3], 21, "%s", MySQLField[8]);
    format(FamilyInfo[familyid][fRank4], 21, "%s", MySQLField[9]);
    format(FamilyInfo[familyid][fRank5], 21, "%s", MySQLField[10]);
    format(FamilyInfo[familyid][fRank6], 21, "%s", MySQLField[11]);
    format(FamilyInfo[familyid][fMotd], 64, "%s", MySQLField[12]);
    FamilyInfo[familyid][fHouseX] = floatstr(MySQLField[13]);
    FamilyInfo[familyid][fHouseY] = floatstr(MySQLField[14]);
    FamilyInfo[familyid][fHouseZ] = floatstr(MySQLField[15]);
    FamilyInfo[familyid][fHouseIntX] = floatstr(MySQLField[16]);
    FamilyInfo[familyid][fHouseIntY] = floatstr(MySQLField[17]);
    FamilyInfo[familyid][fHouseIntZ] = floatstr(MySQLField[18]);
    FamilyInfo[familyid][fHouseVW] = strval(MySQLField[19]);
    FamilyInfo[familyid][fHouseInt] = strval(MySQLField[20]);
    FamilyInfo[familyid][fHouseValue] = strval(MySQLField[21]);
    FamilyInfo[familyid][fSafeX] = floatstr(MySQLField[22]);
    FamilyInfo[familyid][fSafeY] = floatstr(MySQLField[23]);
    FamilyInfo[familyid][fSafeZ] = floatstr(MySQLField[24]);
    FamilyInfo[familyid][fSafeA] = floatstr(MySQLField[25]);
    FamilyInfo[familyid][fPot] = strval(MySQLField[26]);
    FamilyInfo[familyid][fCrack] = strval(MySQLField[27]);
    FamilyInfo[familyid][fMeth] = strval(MySQLField[28]);
    FamilyInfo[familyid][fAMats] = strval(MySQLField[29]);
    FamilyInfo[familyid][fBMats] = strval(MySQLField[30]);
    FamilyInfo[familyid][fCMats] = strval(MySQLField[31]);
    FamilyInfo[familyid][fDMats] = strval(MySQLField[32]);
    FamilyInfo[familyid][fGun1] = strval(MySQLField[33]);
    FamilyInfo[familyid][fAmmo1] = strval(MySQLField[34]);
    FamilyInfo[familyid][fGun2] = strval(MySQLField[35]);
    FamilyInfo[familyid][fAmmo3] = strval(MySQLField[36]);
    FamilyInfo[familyid][fGun3] = strval(MySQLField[37]);
    FamilyInfo[familyid][fAmmo3] = strval(MySQLField[38]);
    FamilyInfo[familyid][fGun4] = strval(MySQLField[39]);
    FamilyInfo[familyid][fAmmo4] = strval(MySQLField[40]);
    FamilyInfo[familyid][fCash] = strval(MySQLField[41]);
    format(FamilyInfo[familyid][fPlate], 32, "%s", MySQLField[42]);
    FamilyInfo[familyid][fColor] = strval(MySQLField[43]);
    if(FamilyInfo[familyid][fSafeX] != 0.0)
        FamilyInfo[familyid][fSafeID] = CreateDynamicObject(1829, FamilyInfo[familyid][fSafeX], FamilyInfo[familyid][fSafeY], FamilyInfo[familyid][fSafeZ], 0.0, 0.0, FamilyInfo[familyid][fSafeA], FamilyInfo[familyid][fHouseVW], FamilyInfo[familyid][fHouseInt]);
    return 1;
}

public UpdateFamilyStats(familyid)
{
    //FuncLog("UpdateFamilyStats");
    CheckConnection();
    new query[128];
    new escstr[64];
    mysql_real_escape_string(FamilyInfo[familyid][fName], escstr);
    format(UpdateQuery, sizeof(UpdateQuery), "UPDATE `familystats` SET `Name`='%s',", escstr);
    format(query, sizeof(query), "`Members`=%d,", FamilyInfo[familyid][fMembers]);
    strcat(UpdateQuery, query);
    mysql_real_escape_string(FamilyInfo[familyid][fCreator], escstr);
    format(query, sizeof(query), "`Creator`='%s',", escstr);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`BankingRank`=%d,", FamilyInfo[familyid][fBankingRank]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`ClaimRank`=%d,", FamilyInfo[familyid][fClaimRank]);
    strcat(UpdateQuery, query);
    mysql_real_escape_string(FamilyInfo[familyid][fRank1], escstr);
    format(query, sizeof(query), "`Rank1`='%s',", escstr);
    strcat(UpdateQuery, query);
    mysql_real_escape_string(FamilyInfo[familyid][fRank2], escstr);
    format(query, sizeof(query), "`Rank2`='%s',", escstr);
    strcat(UpdateQuery, query);
    mysql_real_escape_string(FamilyInfo[familyid][fRank3], escstr);
    format(query, sizeof(query), "`Rank3`='%s',", escstr);
    strcat(UpdateQuery, query);
    mysql_real_escape_string(FamilyInfo[familyid][fRank4], escstr);
    format(query, sizeof(query), "`Rank4`='%s',", escstr);
    strcat(UpdateQuery, query);
    mysql_real_escape_string(FamilyInfo[familyid][fRank5], escstr);
    format(query, sizeof(query), "`Rank5`='%s',", escstr);
    strcat(UpdateQuery, query);
    mysql_real_escape_string(FamilyInfo[familyid][fRank6], escstr);
    format(query, sizeof(query), "`Rank6`='%s',", escstr);
    strcat(UpdateQuery, query);
    mysql_real_escape_string(FamilyInfo[familyid][fMotd], escstr);
    format(query, sizeof(query), "`HouseX`='%.3f',", FamilyInfo[familyid][fHouseX]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`HouseY`='%.3f',", FamilyInfo[familyid][fHouseY]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`HouseZ`='%.3f',", FamilyInfo[familyid][fHouseZ]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`HouseIntX`='%.3f',", FamilyInfo[familyid][fHouseIntX]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`HouseIntY`='%.3f',", FamilyInfo[familyid][fHouseIntY]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`HouseIntZ`='%.3f',", FamilyInfo[familyid][fHouseIntZ]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`HouseVW`=%d,", FamilyInfo[familyid][fHouseVW]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`HouseInt`=%d,", FamilyInfo[familyid][fHouseInt]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`HouseValue`=%d,", FamilyInfo[familyid][fHouseValue]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`SafeX`='%.3f',", FamilyInfo[familyid][fSafeX]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`SafeY`='%.3f',", FamilyInfo[familyid][fSafeY]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`SafeZ`='%.3f',", FamilyInfo[familyid][fSafeZ]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`SafeA`='%.3f',", FamilyInfo[familyid][fSafeA]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`Pot`=%d,", FamilyInfo[familyid][fPot]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`Crack`=%d,", FamilyInfo[familyid][fCrack]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`Meth`=%d,", FamilyInfo[familyid][fMeth]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`AMats`=%d,", FamilyInfo[familyid][fAMats]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`BMats`=%d,", FamilyInfo[familyid][fBMats]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`CMats`=%d,", FamilyInfo[familyid][fCMats]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`DMats`=%d,", FamilyInfo[familyid][fDMats]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`Gun1`=%d,", FamilyInfo[familyid][fGun1]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`Gun2`=%d,", FamilyInfo[familyid][fGun2]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`Gun3`=%d,", FamilyInfo[familyid][fGun3]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`Gun4`=%d,", FamilyInfo[familyid][fGun4]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`Ammo1`=%d,", FamilyInfo[familyid][fAmmo1]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`Ammo2`=%d,", FamilyInfo[familyid][fAmmo2]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`Ammo3`=%d,", FamilyInfo[familyid][fAmmo3]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`Ammo4`=%d,", FamilyInfo[familyid][fAmmo4]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`Cash`=%d,", FamilyInfo[familyid][fCash]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`Plate`='%s',", FamilyInfo[familyid][fPlate]);
    strcat(UpdateQuery, query);
    format(query, sizeof(query), "`Color`=%d,", FamilyInfo[familyid][fColor]);
    strcat(UpdateQuery, query);
    format(query, 128, "`Motd`='%s' WHERE `ID`=%d;", escstr, familyid+1);
    strcat(UpdateQuery, query);
    mysql_query(UpdateQuery);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)