MySQL INSERT problem
#1

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

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

Post your mysql log.
Reply
#3

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)