SA-MP Forums Archive
Error in mysql_query - 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: Error in mysql_query (/showthread.php?tid=252520)



Error in mysql_query - Ivan_Pantovic - 01.05.2011

Hello, can someone please tell me what should this error mean:
Код:
[13:16:09] Error in mysql_query: 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, interiorid, products, priceprod, maxproducts, world) VALUES (172, '', '156' at line 1
[13:16:09]  SQL: INSERT INTO  businesses (businessid, owned, owner, message, extortion, entrancex, entrancey, entrancez, exitx, exity, exitz, level, price, entrance, till, lock, interiorid, products, priceprod, maxproducts, world) VALUES (172, '', '1568.625122', '-1690.535766', 0.000000, 314.820983, -141.431991, 999.661987, 3.000000, 200000.000000, 1120403456, 100, 1, 7, 5, 500, 100, 0, 100, 500, 0)
[13:16:09] Using existing connection!
Is it because something was written in the other way in the script and phpmyadmin(mysql server) or because i wrongly defined variables in the script or something else?

Thanks

edit:
just noticed that whole " owned, owner, message, extortion" part is missing in values
Heres how i made it in pawno:
Код:
CreateBusinessInMYSQL(idx)
{
	new query[512];
	ConnectToDatabase();
	printf("Updating business %d....", idx);
	format(query, sizeof(query), "INSERT INTO  businesses (businessid, owned, owner, message, extortion, entrancex, entrancey, entrancez, exitx, exity, exitz, level, price, entrance, till, lock, interiorid, products, priceprod, maxproducts, world) VALUES (%d, '%s', '%s', '%s', %f, %f, %f, %f, %f, %f, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", idx,BizzInfo[idx][bOwned],BizzInfo[idx][bOwner],BizzInfo[idx][bMessage],
	BizzInfo[idx][bExtortion],BizzInfo[idx][bEntranceX],BizzInfo[idx][bEntranceY],BizzInfo[idx][bEntranceZ],BizzInfo[idx][bExitX],BizzInfo[idx][bExitY],BizzInfo[idx][bExitZ],BizzInfo[idx][bLevelNeeded],BizzInfo[idx][bBuyPrice],BizzInfo[idx][bEntranceCost],BizzInfo[idx][bTill],BizzInfo[idx][bLocked],BizzInfo[idx][bInterior],BizzInfo[idx][bProducts],BizzInfo[idx][bPriceProd],BizzInfo[idx][bMaxProducts],BizzInfo[idx][bWorld]);//used to move from files to mysql
	samp_mysql_query(query);
	printf(" SQL: %s",query);
	return 1;
}



Re: Error in mysql_query - admantis - 01.05.2011

I think you should move the last %d on the start of values(...)


Re: Error in mysql_query - Ivan_Pantovic - 01.05.2011

Quote:
Originally Posted by admantis
Посмотреть сообщение
I think you should move the last %d on the start of values(...)
Just checked - your right, let me see is it working now, THANK YOU VERY MUCH!