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=310215)



mySQL problem - printer - 11.01.2012

pawn Код:
format(sql, sizeof(sql), "INSERT INTO vehicles (Model, Owner, Locked, Lock, Alarm, Insurance, Color1, Color2, Plate, vX, vY, vZ, Owned) VALUES (%d, '%s', 0, 0, 0, 1, 0, 0, '%s', 1182.9319, -1324.0872, 13.5783, 1)", model, GetName(playerid, false), "LosSantos");
                        mysql_query(sql);
[/pawn]

It won't insert for some reason, help please!


Re: mySQL problem - T0pAz - 11.01.2012

Show us your mysql log using mysql_debug(1); on OnGameModeInit.


Re: mySQL problem - Kyosaur - 11.01.2012

Lock is a reserved word, i believe this is your problem. This is why its considered good practice to surround column and table names with ` and `. You should definitely get in the habit of doing that.


Код:
INSERT INTO `vehicles` (`Model`, `Owner`, `Locked`, `Lock`, `Alarm`, `Insurance`, `Color1`, `Color2`, `Plate`, `vX`, `vY`, `vZ`, `Owned`) VALUES (%d, '%s', 0, 0, 0, 1, 0, 0, '%s', 1182.9319, -1324.0872, 13.5783, 1)