MySQL Error with INSERT INTO
#1

I'm trying to execute these lines but seems it won't work.

Code:
mysql_format(Database, queryString, sizeof(queryString), "INSERT INTO 'users' ('name', 'password', 'salt', 'email', 'gender', 'admin', 'tutorial') VALUES ('%e', '%e', '%e', 'test@test.com', %d, 0, 0)",
		user[playerid][p_name],
		user[playerid][p_password], 
		user[playerid][salt],
		// user[playerid][email],
		user[playerid][gender]);
mysql_tquery(Database, queryString, "OnPlayerRegister", "d", playerid);
Log:

Code:
[17:24:58]
[DEBUG] pushed value 'INSERT INTO 'users' ('name', 'password', 'salt', 'email', 'gender', 'admin', 'tutorial') VALUES ('Username', '2C211AF4CF64C25CEB3EE09322B3DD0F1EDA9B19B73E410B47F8D818E88BF554', 'q6[7\\r=KG_', 'test@test.com', 1, 0, 0)' onto AMX stack
[17:24:58] [DEBUG] processing internal specifier 's'
[17:24:58] [DEBUG] pushed value 'OnPlayerRegister' onto AMX stack
[17:24:58] [DEBUG] processing internal specifier 's'
[17:24:58] [DEBUG] pushed value '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 ''users' ('name', 'password', 'salt', 'email', 'gender', 'admin', 'tutorial') VAL' at line 1' onto AMX stack
[17:24:58] [DEBUG] processing internal specifier 'c'
[17:24:58] [DEBUG] pushed value '1064' onto AMX stack
[17:24:58] [DEBUG] executing AMX callback with index '-10046'
[17:24:58] [DEBUG] AMX callback executed with error '0'
[17:24:58] [INFO] Callback successfully executed.
Reply
#2

Anything inside single quotes 'users' is taken as literal text. `user` or just user for no reserved keywords.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)