SA-MP Forums Archive
[MySQL] How to use the mysql_fetch_field_row to float? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [MySQL] How to use the mysql_fetch_field_row to float? (/showthread.php?tid=106596)



[MySQL] How to use the mysql_fetch_field_row to float? - bskillerbr - 04.11.2009

Hello everyone !
Well I'm using the mysql plugin (http://forum.sa-mp.com/index.php?topic=79352.0) I am not able to put get data that are float or integer with mysql_fetch_field_row(error) ...
Do you have any that I can use in place of it?
thanks


Re: [MySQL] How to use the mysql_fetch_field_row to float? - Sergei - 04.11.2009

If you select only one field which is float or integer ("SELECT float WHERE blabla" or "SELECT number WHERE blabla") you do it like this:

pawn Код:
mysql_query("SELECT somefloat WHERE me='Im cool');
mysql_store_result();

new integer = mysql_fetch_int();

new Float:float
mysql_fetch_float(float)

mysql_free_result();
However if you select more fileds and you want to extract floats use floatstr, if you want to extract integers use strval. You can also use sscanf insteaf of strval or floatstr.


And next time post in plugin's topic instead of making new one.