SA-MP Forums Archive
MySQL INSERT problem - 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)
+--- Thread: MySQL INSERT problem (/showthread.php?tid=604444)



MySQL INSERT problem - mrkiller90 - 05.04.2016

Hey guys,

I am having some trouble with the SQL INSERT syntax, here is where I got the error:

Код:
format(query,sizeof(query),"INSERT INTO `users` (`username`,`password`,`money`,`bankmoney`,`skin`,`adminlevel`) VALUES ('%s','%s',0,0,97,0)",GetPName(playerid),upassword);
mysql_function_query(dbcnn,query,false,"","");
Can someone find out where please?

PS:. The variables upassword and query are created


Re: MySQL INSERT problem - introzen - 05.04.2016

What is the "problem"? Is the query received by the MySQL-server?

Post your mysql log.


Re: MySQL INSERT problem - mrkiller90 - 05.04.2016

Mysql LOG:
Код:
[10:51:21] [ERROR] CMySQLQuery::Execute[()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1



Re: MySQL INSERT problem - AndySedeyn - 05.04.2016

Unrelated to your problem, I recommend escaping your strings before putting them in a query.
O.T.: It's possible that the destination string is too small (which should also be in your log). If that's the case then increasing the size of the query variable should fix it.


Re: MySQL INSERT problem - mrkiller90 - 05.04.2016

That was the problem! I declared the query too small, I dont believe I didn't see it. Thanks!