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



Error with mysql_query - Ciklopaz - 18.09.2017

Hello. I have a problem with mysql_query. And error is (40) : error 035: argument type mismatch (argument 1). 40 line is mysql_query(query); And I don't know problem with that. Can you explain it to me ?

Код:
public OnPlayerDisconnect(playerid)
{
new Float:x, Float:y, Float:z, query[250], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerPos(playerid, x, y, z);
format(query, sizeof(query), "UPDATE `positions` SET `x`=%f AND `y`=%f AND `z`=%f WHERE `name`='%s'", x, y, z, name);
mysql_query(query);
return 1;
}



Re: Error with mysql_query - Kane - 18.09.2017

You're using the AND condition incorrectly. Here's a tutorial that explains the usage.

PHP код:
format(querysizeof(query), "UPDATE positions SET x = %f, Y = %f, Z = %f WHERE name = '%e'); 



Re: Error with mysql_query - Ciklopaz - 18.09.2017

Still same error.


Re: Error with mysql_query - Kane - 18.09.2017

The errors from mysql_query.

Parameters:
Код:
(conhandle, query[], bool:use_cache = true)
You're missing your connection handle.


Re: Error with mysql_query - Kaperstone - 18.09.2017

Use mysql_tquery or mysql_pquery unless you know what you're doing.

https://sampwiki.blast.hk/wiki/MySQL/R40#mysql_query


Re: Error with mysql_query - raydx - 19.09.2017

You are missing connection handle argument (first argument).


Re: Error with mysql_query - Kane - 19.09.2017

Quote:
Originally Posted by raydx
Посмотреть сообщение
You are missing connection handle argument (first argument).
:thinking:


Re: Error with mysql_query - Ciklopaz - 19.09.2017

Thanks guy for help.