PDA

View Full Version : MYSQL Help Error


wilko1995
06/02/2013, 08:23 AM
GetPlayerName(playerid, Name, sizeof(Name));
mysql_query("SELECT `password` FROM `player` WHERE `username`=`%s`", Name);

H:\RP\filterscripts\msql.pwn(218) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase

Hello,

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

Thanks

3ventic
06/02/2013, 08:26 AM
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).

wilko1995
06/02/2013, 08:28 AM
so like
format(str, sizeof(str), "SELECT `password` FROM `player` WHERE `username` = `%s`", Name);
mysql_query(str);

thanks

Kirollos
06/02/2013, 09:45 AM
so like
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'