[Mysql]argument type mismatch (argument 1)
#1

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)
Reply
#2

But when i make money[8];
it gives me the same error with argument 2
Reply
#3

pawn Код:
new tmp[8];
mysql_get_field("Money", tmp);
SetPlayerMoney(playerid, strval(tmp));
Do not forget to release the result
Reply
#4

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.
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)