format(query,sizeof(query),"INSERT INTO texts (ID,distance,x,y,z,xx,yy,zz,text,vw,int,vww,intt) VALUES (%i,%i,%f,%f,%f,%f,%f,%f,'%s',%i,%i,%i,%i)",
id,T[id][dDistance],T[id][tX],T[id][tY],T[id][tZ],T[id][tXx],T[id][tYy],T[id][tZz],T[id][xText],T[id][xVW],T[id][xInt],T[id][xVWw],T[id][xIntt]);
mysql_tquery(mysql,query,"testtest");
INSERT INTO texts (ID,distance,x,y,z,xx,yy,zz,text,vw,int,vww,intt) VALUES (1,50,1555.216796,-1726.411987,13.546875,0.000000,0.000000,0.000000,'Test',0,0,0,0)
[20:32:25] [ERROR] CMySQLQuery::Execute[testtest] - (error #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 'int,vww,intt) VALUES (1,10,1559.668945,-1727.496459,13.382812,0.000000,0.000000,' at line 1
Mind telling the steps how you solve it? I would appreciate it a lot
Thanks! |
INSERT INTO `texts` (`ID`,`distance`,`x`,`y`,`z`,`xx`,`yy`,`zz`,`text`,`vw`,`int`,`vww`,`intt`) VALUES ('%i','%i','%f','%f','%f','%f','%f','%f','%s','%i','%i','%i','%i')
My guess would be: int is a reserved keyword thus he needed to add quotation marks to int.
|
That is exactly the problem. However, 'text' is a reserved word as well, that is why the error was right before the 'int'.
As a rule of thumb in MySQL: Always add backticks to column names and table names and add single quotation marks (apostrophes) to string values. |