SA-MP Forums Archive
SQL syntax. - 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)
+--- Thread: SQL syntax. (/showthread.php?tid=652426)



SQL syntax. - lolya93 - 10.04.2018

i have a sql syntax problem there is code:

Code:
	new Query[256], pName[35];
		new Float:x, Float:y, Float:z;

		GetPlayerName(playerid, pName, 35);
		GetPlayerPos(playerid, x, y, z);

		mysql_format(ConnectMySQL, Query, sizeof(Query), "UPDATE `aractrash` SET `tposX` = %f, `tposY` = %f, tposZ = %f, `KullaniciAdi` = %s)x, ,y ,z ,pName");
		mysql_tquery(ConnectMySQL, Query);
gives this.
Code:
error 076: syntax error in the expression, or invalid function call



Re: SQL syntax. - kovac - 10.04.2018

You have put ) instead of " and forgot ,

PHP Code:
new Query[256], pName[35];
new 
Float:xFloat:yFloat:z;
GetPlayerName(playeridpName35);
GetPlayerPos(playeridxyz);
mysql_format(ConnectMySQLQuerysizeof(Query), "UPDATE `aractrash` SET `tposX` = '%f', `tposY` = '%f', tposZ = '%f', `KullaniciAdi` = '%s'"x, ,,,pName);
mysql_tquery(ConnectMySQLQuery); 



Re: SQL syntax. - lolya93 - 10.04.2018

thanks but didn't work.

now gives that
PHP Code:
C:\Users\**\Desktop\3d\gamemodes\...pwn(288) : warning 215expression has no effect
C
:\Users\**\Desktop\3d\gamemodes\...pwn(288) : warning 215expression has no effect
C
:\Users\**\Desktop\3d\gamemodes\....pwn(288) : warning 215expression has no effect
C
:\Users\**\Desktop\3d\gamemodes\....pwn(288) : error 001expected token";"but found ")"
C:\Users\**\Desktop\3d\gamemodes\...pwn(288) : fatal error 107too many error messages on one line
Compilation aborted
.Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
4 Errors

PHP Code:
line 288
    mysql_format
(ConnectMySQLQuerysizeof(Query), "UPDATE `aractrash` SET `tposX` = '%f', `tposY` = '%f', tposZ = '%f', `KullaniciAdi` = '%s'"x, ,,,pName); 



Re: SQL syntax. - ThinAir - 10.04.2018

Quote:
Originally Posted by kovac
View Post
You have put ) instead of " and forgot ,

PHP Code:
new Query[256], pName[35];
new 
Float:xFloat:yFloat:z;
GetPlayerName(playeridpName35);
GetPlayerPos(playeridxyz);
mysql_format(ConnectMySQLQuerysizeof(Query), "UPDATE `aractrash` SET `tposX` = '%f', `tposY` = '%f', tposZ = '%f', `KullaniciAdi` = '%s'"x, ,,,pName);
mysql_tquery(ConnectMySQLQuery); 
You have one extra comma ...'%s'", x, ,y ,z ,pName);


Re: SQL syntax. - lolya93 - 10.04.2018

Quote:
Originally Posted by ThinAir
View Post
You have one extra comma ...'%s'", x, ,y ,z ,pName);
thanks


Re: SQL syntax. - ISmokezU - 10.04.2018

PHP Code:
new Query[256], pName[35];
new 
Float:xFloat:yFloat:z;
GetPlayerName(playeridpName35);
GetPlayerPos(playeridxyz);
mysql_format(ConnectMySQLQuerysizeof(Query), "UPDATE aractrash SET tposX = %f, tposY = %f, tposZ = %f, KullaniciAdi = %s"xyzpName);
mysql_tquery(ConnectMySQLQuery); 



Re: SQL syntax. - lolya93 - 10.04.2018

Quote:
Originally Posted by ISmokezU
View Post
PHP Code:
new Query[256], pName[35];
new 
Float:xFloat:yFloat:z;
GetPlayerName(playeridpName35);
GetPlayerPos(playeridxyz);
mysql_format(ConnectMySQLQuerysizeof(Query), "UPDATE aractrash SET tposX = %f, tposY = %f, tposZ = %f, KullaniciAdi = %s"xyzpName);
mysql_tquery(ConnectMySQLQuery); 
thanks guys.
PHP Code:
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
 no errors