SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 29/03/2020, 03:28 PM   #1
Saddin
Huge Clucker
 
Saddin's Avatar
 
Join Date: Mar 2011
Posts: 372
Reputation: 35
Default MySQL Error with INSERT INTO

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.
Saddin is offline   Reply With Quote
Old 29/03/2020, 03:47 PM   #2
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,227
Reputation: 205
Default Re: MySQL Error with INSERT INTO

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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Insert Error IdonTmiss Scripting Help 3 13/08/2018 12:00 AM
INSERT INTO mysql error OMonger Scripting Help 5 10/01/2016 06:40 PM
MySQL - INSERT INTO error Rdx Scripting Help 4 19/02/2013 02:02 PM
Mysql INSERT INTO Error Larry123 Scripting Help 1 02/09/2012 03:18 PM
MySQL Insert ID Error CoaPsyFactor Scripting Help 2 07/06/2012 11:13 PM


All times are GMT. The time now is 07:03 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.