SA-MP Forums Archive
MySQL UPDATE query error - 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 UPDATE query error (/showthread.php?tid=575263)



MySQL UPDATE query error - SandKing94 - 25.05.2015

Code:
format(query,sizeof(query),"UPDATE factions SET Rank 1 = '%s' WHERE ID = %d",inputtext,EditingFacid);
mysql_function_query(Connection,query,false,"","");
Error:
Code:
[12:07:09] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE factions SET Rank 1 = asdasd WHERE ID = 53", callback: "(null)", format: "(null)"
[12:07:09] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[12:07:09] [ERROR] CMySQLQuery::Execute[] - (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 '1 = azzaz WHERE ID = 53' at line 1
[12:07:09] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError



Re: MySQL UPDATE query error - Konstantinos - 25.05.2015

Is this even the same? Take a better look:

format(query,sizeof(query),"UPDATE factions SET Rank 1 = '%s' WHERE ID = %d",inputtext,EditingFacid);

[12:07:09] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE factions SET Rank 1 = asdasd WHERE ID = 53", callback: "(null)", format: "(null)"

[12:07:09] [ERROR] CMySQLQuery::Execute[] - (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 '1 = azzaz WHERE ID = 53' at line 1


- Your query has ' ' around %s which is correct.
- While executing, it doesn't have ' ' around and it displays asdasd only.
- On triggering of the error, it displays azzaz.

It just makes no sense.


Re: MySQL UPDATE query error - MikE1990 - 25.05.2015

Your field is Rank1 or Rank 1?
Code:
format(query,sizeof(query),"UPDATE factions SET Rank1 = '%s' WHERE ID = %d",inputtext,EditingFacid);
mysql_function_query(Connection,query,false,"","");



Re: MySQL UPDATE query error - SandKing94 - 25.05.2015

Oh i posted wrong sql log.
New log:
Code:
[12:07:28] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE factions SET Rank 1 = 'asdasd' WHERE ID = 53", callback: "(null)", format: "(null)"
[12:07:28] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[12:07:28] [ERROR] CMySQLQuery::Execute[] - (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 '2 = 'asdasd' WHERE ID = 53' at line 1
[12:07:28] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError



Re : MySQL UPDATE query error - Mathieu371 - 25.05.2015

Quote:
Originally Posted by SandKing94
View Post
Code:
format(query,sizeof(query),"UPDATE factions SET Rank 1 = '%s' WHERE ID = %d",inputtext,EditingFacid);
mysql_function_query(Connection,query,false,"","");
Code:
format(query,sizeof(query),"UPDATE factions SET `Rank 1` = '%s' WHERE ID = %d",inputtext,EditingFacid);
mysql_function_query(Connection,query,false,"","");



Re: Re : MySQL UPDATE query error - SandKing94 - 25.05.2015

Quote:
Originally Posted by Mathieu371
View Post
Code:
format(query,sizeof(query),"UPDATE factions SET `Rank 1` = '%s' WHERE ID = %d",inputtext,EditingFacid);
mysql_function_query(Connection,query,false,"","");
Thank you.


Re: MySQL UPDATE query error - PowerPC603 - 25.05.2015

It's recommended that you don't use spaces in column names.
Then you don't even need the ` around your column names.