MySQL Problems
#1

For some reason I am getting this problem

Code:
CMySQLHandler::Query(яяяя) - An error has occured. (Error ID: 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 'яяяя' at line 1)
Being brought about by this line

Code:
format(Query,sizeof(Query),"INSERT INTO `Users` (Username,Password,Money) VALUES ('%s','%s,'0')",GetPlayerName(playerid),EscapedText);
Any help would be great thanks.
Reply
#2

the values from EscapedText?
Reply
#3

Quote:
Originally Posted by _Zume
View Post
the values from EscapedText?
Thanks for the reply
Here are is EscapedText

All takes place under OnDialogResponse

Code:
ShowPlayerDialog(playerid,1336,DIALOG_STYLE_INPUT,"Register - Enter your password","You are about to register a new account! \nPlease choose the password for it! \n","Register!","");
Code:
mysql_real_escape_string(inputtext, EscapedText);
Reply
#4

PHP Code:
printf("[MySql]   %s"Query); 
And show us this part from the server log.
Reply
#5

Quote:
Originally Posted by nezo2001
View Post
PHP Code:
printf("[MySql]   %s"Query); 
And show us this part from the server log.
Thanks for the help

Here is what you requested

Code:
[21:54:21] [MySql]   ”SERT INTO `Users` (Username,Password,Money) VALUES ('',','0')
Reply
#6

BUMP
Reply
#7

I believe you are messing a " ' ", colored red in the line.
Code:
format(Query,sizeof(Query),"INSERT INTO `Users` (Username,Password,Money) VALUES ('%s','%s','0')",GetPlayerName(playerid),EscapedText);
Also looks like your query isn't formatted properly, as it's giving blank values instead of a password/name

If you would post the whole function or callback I believe I will be able to help.
Reply
#8

Quote:
Originally Posted by xVIP3Rx
View Post
I believe you are messing a " ' ", colored red in the line.
Code:
format(Query,sizeof(Query),"INSERT INTO `Users` (Username,Password,Money) VALUES ('%s','%s','0')",GetPlayerName(playerid),EscapedText);
Also looks like your query isn't formatted properly, as it's giving blank values instead of a password/name

If you would post the whole function or callback I believe I will be able to help.
Thanks for the reply, seems I and others overlooked this little late night amatuer mistake.

Code:
format(Query,sizeof(Query),"INSERT INTO `Users` (Username,Password,Money) VALUES ('%s', '%s', '0')",GetPlayerName(playerid),EscapedText);
Should be:

Code:
GetPlayerName(playerid, PlayerNameSQL, sizeof(PlayerNameSQL));
format(Query,sizeof(Query),"INSERT INTO `Users` (Username,Password,Money) VALUES ('%s', '%s', '0')",PlayerNameSQL,EscapedText);
Works as desired now, thanks to all that gave me some tips.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)