sql syntax - 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: sql syntax (
/showthread.php?tid=181972)
sql syntax -
armyoftwo - 08.10.2010
i am stuggling with this for some time now, i really don't know whats the prob, i have checked everything like 10 times!
Code:
format(string, sizeof(string), "INSERT INTO factory (Owner, Type, Stock, Bank, Lock, X,Y,Z, ProduceRate, Sell) VALUES('%i', '%i', '%f', '%i', '%i', '%f', '%f', '%f', '%f', '%i' )",
-1, type, 10.0, 0, 0, X,Y,Z, producerate, price );
mysql_query(string);
mysql_query("SELECT MAX(SQLID) FROM factory");
mysql_store_result();
Code:
[15:19:48] CMySQLHandler::Query(INSERT INTO factory (Owner, Type, Stock, Bank, Lock, X,Y,Z, ProduceRate, Sell) VALUES('-1', '4', '0.000000', '0', '0', '2809.512939', '-2393.026611', '13.628358', '800.599975', '500' )) - 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 'Lock, X,Y,Z, ProduceRate, Sell) VALUES('-1', '4', '0.000000', '0', '0', '2809.51' at line 1)
[15:19:48] >> mysql_query( Connection handle: 1 )
[15:19:48] CMySQLHandler::Query(SELECT MAX(SQLID) FROM factory) - Successfully executed.
Re: sql syntax -
Relixious - 08.10.2010
Your string is too small?
Try setting it to 256.
Re: sql syntax -
armyoftwo - 08.10.2010
do you think 512 is too small? lol
i use 512 for all queries and there's no problems so there's no problems with the string size
I created an business, house and other sys with this method, but this doesn't work
Re: sql syntax -
Relixious - 08.10.2010
Quote:
Originally Posted by armyoftwo
do you think 512 is too small? lol
|
No, it's alright, 256 should be fine to.
Re: sql syntax -
iJumbo - 08.10.2010
try this
pawn Code:
INSERT INTO factory (`Owner`, `Type`, `Stock`, `Bank`, `Lock`, `X`,`Y`,`Z`, `ProduceRate`, `Sell`) VALUES('%i', '%i', '%f', '%i', '%i', '%f', '%f', '%f', '%f', '%i' )",
Re: sql syntax -
armyoftwo - 08.10.2010
Quote:
Originally Posted by gigi1223
try this
pawn Code:
INSERT INTO factory (`Owner`, `Type`, `Stock`, `Bank`, `Lock`, `X`,`Y`,`Z`, `ProduceRate`, `Sell`) VALUES('%i', '%i', '%f', '%i', '%i', '%f', '%f', '%f', '%f', '%i' )",
|
omg, thanks. My eyes hurt now. what was the prob?
Re: sql syntax -
iJumbo - 08.10.2010
you ahve 2 addl ` to every definition like `Owner` not Owner ...
This forum requires that you wait 120 seconds between posts. Please try again in 8 seconds. --_--