SA-MP Forums Archive
mysql syntax prob - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: mysql syntax prob (/showthread.php?tid=186067)



mysql syntax prob - armyoftwo - 27.10.2010

Код:
      format(string, 200, "INSERT INTO vehicles (`Model`,`vPos`,` vPos2`, `vPos3`, `vPos4`, `color1`, `color2`, `price`, `rent`, `buyable`, `faction`, `crew`, `job`, `fuel`) VALUES('%i', '%f', '%f', '%f', '%f', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i', '%i')",
	  model, x, y, z, a, color1, color2, price, rent, buyable, faction, crew, job, 100);
Код:
[15:32:26] CMySQLHandler::Query(INSERT INTO vehicles (`Model`,`vPos`,` vPos2`, `vPos3`, `vPos4`, `color1`, `color2`, `price`, `rent`, `buyable`, `faction`, `crew`, `job`, `fuel`) VALUES('411', '2795.434326', '-2398.064941', '15.401) - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''15.401' at line 1)
I don't see anything wrong there


Re: mysql syntax prob - DarrenReeder - 27.10.2010

Im not sure either mate... but a small tip ... use
pawn Код:
format(string, sizeof(string)
Its better to use sizeof() rather than putting a number in that parameter

EDIT:
sorry i couldnt help with the question though


Re: mysql syntax prob - armyoftwo - 27.10.2010

Thanks for the tip.
I fixed this anyways


Re: mysql syntax prob - DarrenReeder - 27.10.2010

Ah good, what was the problem and what fixed it? (just so i know for future or anyone that comes across this thread with the same problem)


Re: mysql syntax prob - armyoftwo - 27.10.2010

I didn't saw the size i was formatting, so i formatted only 200 but the real string size is 512(for mysql queries) so the problem was format size..


Re: mysql syntax prob - Think - 09.11.2010

you forgot a ' at the end lol.