sql syntax
#1

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.
Reply
#2

Your string is too small?
Try setting it to 256.
Reply
#3

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
Reply
#4

Quote:
Originally Posted by armyoftwo
View Post
do you think 512 is too small? lol
No, it's alright, 256 should be fine to.
Reply
#5

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' )",
Reply
#6

Quote:
Originally Posted by gigi1223
View Post
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?
Reply
#7

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. --_--
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)