MYSQL INSTERT INTO error
#1

hey, I do not understand why an error here..

Код:
CMD:email( playerid, params[] )
{
	new
		String[ 128             ],
		Vardas[ MAX_PLAYER_NAME ],
		Email [ 256             ]
	;

	if( sscanf( params, "ss", Email, isnull ( params ) ) ) return SendClientMessage(playerid, -1, ""HEX_RAUDONA"- "HEX_BALTA"/email [EMAIL] [PRISIJUGNIMO_SLAPTAZODIS]");

    GetPlayerName( playerid, Vardas, sizeof( Vardas ) );
	
	format       ( String, sizeof( String ), "INSERT INTO `Email_Adresai` (Prisijungimo_Vardas, Email_Slaptazodis, Email) VALUES ('%s',  '%s' , '%s')" ,Vardas, params, Email );
	mysql_query  ( String );
	
	SendClientMessage( playerid, -1, " "HEX_RAUDONA"- "HEX_BALTA"--" );
	return 1;
}
Mysql_Log Error:

Код:
[22:10:55] CMySQLHandler::Query(INSERT INTO `Email_Adresai` (Prisijungimo_Vardas, Email_Slaptazodis, Email) VALUES ('oooooo', md5 ( 'renisil@inbox.lt lolas' ),) - 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)
What's wrong? Thank you..
Reply
#2

try
Код:
INSERT INTO `Email_Adresai` (`Prisijungimo_Vardas`, `Email_Slaptazodis`, `Email`) VALUES ('%s',  '%s' , '%s')
Reply
#3

Код:
[15:23:21] CMySQLHandler::Query(INSERT INTO `Email_Adresai` (`Prisijungimo_Vardas`, `Email_Slaptazodis`, `Email`) VALUES ('oooooo',  'renisil@inbox.lt lolas' ,) - 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)
nothing..
Reply
#4

Firstly, stop being excessive with your spacing, it just makes it harder to read!

Secondly, you can't just use graves (`) and then stop using them. You need to use them for all field names in a query. Here's your fixed code:

If the code below doesn't work, increase the size of your string to something that exceeds 128 characters, i.e: 200.

pawn Код:
format(String, sizeof(String), "INSERT INTO `Email_Adresai` (`Prisijungimo_Vardas`, `Email_Slaptazodis`, `Email`) VALUES ('%s',  '%s', '%s')", Vardas, params, Email);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)