SA-MP Forums Archive
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: Error (/showthread.php?tid=616843)



Error - RuNBoY - 11.09.2016

Hi, whats wrong here?

Код:
new pname[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pname,MAX_PLAYER_NAME);
        mysql_free_result();
        mysql_query("SELECT id FROM playerdata WHERE user = '%s'",pname);
        mysql_store_result();
        new uid = mysql_num_rows();
        mysql_free_result();
Shows me this error:

Код:
(4219): error 035: argument type mismatch (argument 2)
Line 4219 is : mysql_query("SELECT id FROM playerdata WHERE user = '%s'",pname)


Re: Error - Stuntff - 11.09.2016

Код:
new str[41+MAX_PLAYER_NAME];
format(str,sizeof(str),"SELECT id FROM playerdata WHERE user = '%e'",pname);
mysql_query(str);



Re: Error - Konstantinos - 11.09.2016

%e specifier works only with mysql_format.

By the way, remove the first mysql_free_result (after getting player's name) as it has no meaning and consider updating to newer version of the mysql plugin.


Re: Error - RuNBoY - 11.09.2016

Its not outputting the user id.


Re: Error - Konstantinos - 11.09.2016

https://sampwiki.blast.hk/wiki/MySQL#mysql_fetch_int