SA-MP Forums Archive
MYSQL Help 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)
+--- Thread: MYSQL Help Error (/showthread.php?tid=413641)



MYSQL Help Error - wilko1995 - 06.02.2013

Code:
GetPlayerName(playerid, Name, sizeof(Name));
mysql_query("SELECT `password` FROM `player` WHERE `username`=`%s`", Name);
Code:
H:\RP\filterscripts\msql.pwn(218) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Hello,

I would like to know what i have done incorrectly in this code to result in the error

Thanks


Re: MYSQL Help Error - 3ventic - 06.02.2013

You cannot use mysql_query like you use format. You need to use format() to format a string first, and then mysql_query(the string you formatted).


Re: MYSQL Help Error - wilko1995 - 06.02.2013

so like
Code:
format(str, sizeof(str), "SELECT `password` FROM `player` WHERE `username` = `%s`", Name);
mysql_query(str);
thanks


Re: MYSQL Help Error - Kirollos - 06.02.2013

Quote:
Originally Posted by wilko1995
View Post
so like
Code:
format(str, sizeof(str), "SELECT `password` FROM `player` WHERE `username` = `%s`", Name);
mysql_query(str);
thanks
Exactly,

but here in WHERE `username` = `%s`

it should be WHERE `username` = '%s'