MySQL UPDATE query error
#1

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

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

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,"","");
Reply
#4

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

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,"","");
Reply
#6

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)