SA-MP Forums Archive
MYSQL 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: MYSQL PROBLEM (/showthread.php?tid=419362)



MYSQL PROBLEM - Cake12345 - 28.02.2013

Hi! Why dosent this work?? It should save.. But it dosent. when I relog it get removed..

Please help

pawn Код:
new var[32];
                for (new i = 1; i < 11; i++)
                {
                    format(var, sizeof(var), "`clothBone%d` = '%d', ", i);
                    formatcat(query, var, ClothingInfo[playerid][clothBone][i]);

                    format(var, sizeof(var), "`clothSlot%d` = '%d', ", i);
                    formatcat(query, var, ClothingInfo[playerid][clothSlot][i]);

                    format(var, sizeof(var), "`clothSlot%d_X` = '%f', ", i);
                    formatcat(query, var, ClothingInfo[playerid][clothSlot_X][i]);

                    format(var, sizeof(var), "`clothSlot%d_Y` = '%f', ", i);
                    formatcat(query, var, ClothingInfo[playerid][clothSlot_Y][i]);

                    format(var, sizeof(var), "`clothSlot%d_Z` = '%f', ", i);
                    formatcat(query, var, ClothingInfo[playerid][clothSlot_Z][i]);

                    format(var, sizeof(var), "`clothSlot%d_RX` = '%f', ", i);
                    formatcat(query, var, ClothingInfo[playerid][clothSlot_RX][i]);

                    format(var, sizeof(var), "`clothSlot%d_RY` = '%f', ", i);
                    formatcat(query, var, ClothingInfo[playerid][clothSlot_RY][i]);

                    format(var, sizeof(var), "`clothSlot%d_RZ` = '%f', ", i);
                    formatcat(query, var, ClothingInfo[playerid][clothSlot_RZ][i]);

                    format(var, sizeof(var), "`clothSlot%d_SX` = '%f', ", i);
                    formatcat(query, var, ClothingInfo[playerid][clothSlot_SX][i]);

                    format(var, sizeof(var), "`clothSlot%d_SY` = '%f', ", i);
                    formatcat(query, var, ClothingInfo[playerid][clothSlot_SY][i]);

                    format(var, sizeof(var), "`clothSlot%d_SZ` = '%f', ", i);
                    formatcat(query, var, ClothingInfo[playerid][clothSlot_SZ][i]);

                    format(var, sizeof(var), "`clothingName%d` = '%s', ", i);
                    formatcat(query, var, ClothingName[playerid][i]);
                }



Re: MYSQL PROBLEM - Misiur - 28.02.2013

What is formatcat?


Re: MYSQL PROBLEM - Cake12345 - 28.02.2013

pawn Код:
#define formatcat(%1,%2,%3) do { new _str[255]; format(_str, 255, %2, %3); strcat(%1,_str); } while(FALSE)



Re: MYSQL PROBLEM - Vince - 28.02.2013

If you feel the need to append numbers to field names then your table structure is a mess. Use less columns and more rows. For your sake I hope that this isn't the main player table either. You should be looking at a structure like:

userid slotid bone x y z rx ry rz sx sy sz name
1 1 2 0 0 0 0 0 0 0 0 0 foo
1 4 1 0 0 0 0 0 0 0 0 0 bar



Re: MYSQL PROBLEM - Cake12345 - 28.02.2013

Yes but that no slove problem


Re: MYSQL PROBLEM - Cake12345 - 28.02.2013

BUMP


Re: MYSQL PROBLEM - CoaPsyFactor - 01.03.2013

print that whole string after formating and post it here, I think you are missing commas (,) after each column.


Re: MYSQL PROBLEM - mastermax7777 - 01.03.2013

put mysql_debug(1)
and tell us what you get from that query.