[Mysql]argument type mismatch (argument 1) - 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]argument type mismatch (argument 1) (
/showthread.php?tid=363408)
[Mysql]argument type mismatch (argument 1) -
TheDeath - 27.07.2012
Can someone tell me why when i try this code:
pawn Код:
new Query[128],money;
format(Query,sizeof(Query),"SELECT * FROM `users` WHERE username = '%s' LIMIT 1",PlayerName(playerid));
mysql_query(Query);
mysql_store_result();
mysql_retrieve_row();
mysql_get_field("Money",money);
SetPlayerMoney(playerid,money);
It return me error:
Код:
argument type mismatch (argument 1)
Re: [Mysql]argument type mismatch (argument 1) -
TheDeath - 27.07.2012
But when i make money[8];
it gives me the same error with argument 2
Re: [Mysql]argument type mismatch (argument 1) -
Misiur - 27.07.2012
pawn Код:
new tmp[8];
mysql_get_field("Money", tmp);
SetPlayerMoney(playerid, strval(tmp));
Do not forget to release the result
Re: [Mysql]argument type mismatch (argument 1) -
TheDeath - 27.07.2012
I dont know why this mysql is made like that if u have ever used mysql in php u will see there is very different.
U can fletch directly and save like $row['Money']. i just cant understand why the samp plugin is made by that way.It seems me too entanglement.
Re: [Mysql]argument type mismatch (argument 1) -
Misiur - 27.07.2012
I haven't been using normal mysql(i)_* queries for many months. I'm working with Doctrine 2 ORM which is even more powerful. Anyway mysql plugin for pawn is really, really simple, but at the same time not too smart. Everything is returned as a string, you have to cast to correct type manually.