SA-MP Forums Archive
SQL save problem - 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: SQL save problem (/showthread.php?tid=427922)



SQL save problem - N0FeaR - 03.04.2013

Here is the save
pawn Код:
public SaveGangs(gangid)
{
    IsDatabaseConnected();
    new sql[1024];
    format(sql, sizeof(sql), "UPDATE gangs SET taken=%d, name='%s', motd='%s', color='%s', leader='%s', members=%d, spawn_x=%f, spawn_y=%f, spawn_z=%f, spawn_angle=%f, spawn_int=%d, mats='%d', drugs=%d, rankname1='%s', rankname2='%s', rankname3='%s', rankname4='%s', rankname5='%s', rankname6='%s', skin1=%d, skin2=%d, skin3=%d, skin4=%d, skin5=%d, skin6=%d WHERE id=%d",
    GangInfo[gangid][GangTaken],
    GangInfo[gangid][GangName],
    GangInfo[gangid][GangMOTD],
    GangInfo[gangid][GangColor],
    GangInfo[gangid][GangLeader],
    GangInfo[gangid][GangSpawn][0],
    GangInfo[gangid][GangSpawn][1],
    GangInfo[gangid][GangSpawn][2],
    GangInfo[gangid][GangSpawn][3],
    GangInfo[gangid][GangInterior],
    GangInfo[gangid][GangMats],
    GangInfo[gangid][GangDrugs],
    GangInfo[gangid][GangMoney],
    GangInfo[gangid][GangRank1],
    GangInfo[gangid][GangRank2],
    GangInfo[gangid][GangRank3],
    GangInfo[gangid][GangRank4],
    GangInfo[gangid][GangRank5],
    GangInfo[gangid][GangRank6],
    GangInfo[gangid][GangSkin1],
    GangInfo[gangid][GangSkin2],
    GangInfo[gangid][GangSkin3],
    GangInfo[gangid][GangSkin4],
    GangInfo[gangid][GangSkin5],
    GangInfo[gangid][GangSkin6],
    gangid );
    printf(" SQL: %s",sql);
    samp_mysql_query(sql);
    //if (DEBUG) SQLLog(sql);
    //printf("%s", sql);
}
So when i like change the motd in game i get this

Код:
[21:36:54]  SQL: UPDATE gangs SET taken=0, name='', motd='Hell', color='', leader='', members=0, spawn_x=0.000000, spawn_y=0.000000, spawn_z=0.000000, spawn_angle=0.000000, spawn_int=0, mats='0', drugs=0, rankname1='', rankname2='', rankname3='', rankname4='', rankname5='', rankname6='', skin1=0, skin2=0, skin3=0, skin4=0, skin5=0, skin6=0 WHERE id=0
[21:36:54] Error in mysql_query: Unknown column 'taken' in 'field list'



Re: SQL save problem - kamzaf - 03.04.2013

That means in you database you dont have a field named "taken". Make a new one and try again.