SA-MP Forums Archive
Issue with mysql_fetch_int - 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: Issue with mysql_fetch_int (/showthread.php?tid=479942)



Issue with mysql_fetch_int - Jonesy96 - 08.12.2013

I've used this in my code:

Код:
mysql_fetch_int("jail_time", jailtime);
Here's the error I got:

Код:
C:\Users\Rhys\Desktop\scripting\gamemodes\sheriffs.pwn(245) : error 035: argument type mismatch (argument 1)
Any ideas? I'm trying to retrieve the jail_time field from the database and store it into the jailtime variable

I'm using this mysql plugin: https://sampwiki.blast.hk/wiki/MySQL_Plugin


Re: Issue with mysql_fetch_int - Dokins - 08.12.2013

You seem to be using the wrong syntax.

Check this out:
(This is from my script)

Quote:

new query[256];
format(query, sizeof(query), "SELECT %s FROM %s WHERE id = %d LIMIT 1", fieldname, tablename, sqlid);
mysql_query(query);
mysql_store_result();
new result = mysql_fetch_int();
mysql_free_result();
return result;

You may also wanna check out this page:

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


Re: Issue with mysql_fetch_int - Jonesy96 - 08.12.2013

Thank you, this has returned no errors. Got a bit confused with that. Many thanks. +1


Re: Issue with mysql_fetch_int - Dokins - 08.12.2013

No problem, although I'd advise you to talk to Vince if you have issues with MySQL. He's pretty good with it.