SA-MP Forums Archive
Hello. Need help with mysql strcat. - 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: Hello. Need help with mysql strcat. (/showthread.php?tid=596892)



Hello. Need help with mysql strcat. - Scrillex - 23.12.2015

Hello

I have problem with this line could some one teach me how to use strcat on big mysql lines...

With best regards Scrillex.

pawn Код:
error 037: invalid string (possibly non-terminated string)
error 017: undefined symbol "INSERT"
error 017: undefined symbol "INTO"
fatal error 107: too many error messages on one line
pawn Код:
mysql_format(mysql, query, sizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `PosX`, `PosY`, `PosZ`, `PosA`,);
            format(query, sizeof(query),`Leader`, `Member`, `Rank`, `JobID`, `StreetRank`, `HouseID`, `BussinesID`, `CarID`, `CarID2`, `DrivingLicense`, `FlyingLicense`, `HeliLicense`,);
            format(query, sizeof(query),`BoatLicense`, `ParasuteLicense`, `TPockets`, `TPocket2`, `JPocket`, `JPocket2`, `TV`, `Radio`, `Mp3Player`, `Computer`, `PhoneNumber`, `MaskID`,);
            format(query, sizeof(query),`PhoneBook`, `FightingSyle`, `WalkingStyle`, `Strenght`, `Fat`, `SkinID`, `Health`, `Armor`, `Weapon`, `Ammo`, `Weapon1`, `Ammo1`, `Weapon2`, `Ammo2`, );
            format(query, sizeof(query),`Weapon3`, `Ammo3`, `Weapon4`, `Ammo4`, `Weapon5`, `Ammo5`, `Weapon6`, `Ammo6`, `Weapon7`, `Ammo7`, `Weapon8`, `Ammo8`, `Weapon9`, `Ammo9`, `WeaponDealer`);
            format(query, sizeof(query),VALUES ('%e', '%e', '%e', 0, 0, 0, %f, %f, %f, %f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, %f, %f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)"
, playername, Player[playerid][Password], playerip, SPAWN_X, SPAWN_Y, SPAWN_Z, SPAWN_A);



Re: Hello. Need help with mysql strcat. - Vince - 23.12.2015

I can only try and teach you how to normalize (see signature) so you don't have to write long lines to begin with. Besides that, there are only 7 actual variables to be inserted. Set default values on the columns.


Respuesta: Hello. Need help with mysql strcat. - Zume - 23.12.2015

moreover, it is not necessary to add all this.. After all MySQL has the ability to set default values in the database, with an insert enough so that the values are restored to defaults and this will be added.


Re: Hello. Need help with mysql strcat. - Scrillex - 23.12.2015

Okay thanks got it how to optimize basically half of the code is not used and unnecessary saved.