SA-MP Forums Archive
MYSQL INSTERT INTO error - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MYSQL INSTERT INTO error (/showthread.php?tid=247014)



MYSQL INSTERT INTO error - RenisiL - 07.04.2011

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


Re: MYSQL INSTERT INTO error - iJumbo - 07.04.2011

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



Re: MYSQL INSTERT INTO error - RenisiL - 07.04.2011

Код:
[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..


Re: MYSQL INSTERT INTO error - Calgon - 07.04.2011

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);