SA-MP Forums Archive
Little help with float+mysql - 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: Little help with float+mysql (/showthread.php?tid=399517)



Little help with float+mysql - Carlґ - 14.12.2012

Hello everybody.

I created a simple system in my gamemode and I need to get a float point, but this code don't works:

pawn Код:
static Float:get_float;
cache_get_field_content(0, "pX", get_float, mysql_handle); EmpInfo[0][E_pX] = Float:get_float;
Someone help-me please? I am beginner with mysql.. thanks


Re: Little help with float+mysql - Djole1337 - 14.12.2012

Use floatstr();


Re: Little help with float+mysql - Carlґ - 14.12.2012

Quote:
Originally Posted by Mr_DjolE
Посмотреть сообщение
Use floatstr();
I've used this, but I get errors with mismatch.

Just for remember, 'pX' I put the type: Float on the phpmyadmin


Re: Little help with float+mysql - Djole1337 - 14.12.2012

Why you don't use cache_get_row(); ?


Re: Little help with float+mysql - Carlґ - 14.12.2012

Because 'cache_get_field_content' have the same function of cache_get_row ...


Re: Little help with float+mysql - Djole1337 - 14.12.2012

Quote:
Originally Posted by Carlґ
Посмотреть сообщение
Because 'cache_get_field_content' have the same function of cache_get_row ...
I've solved my problem by using cache_get_row. Give it a try.


Re: Little help with float+mysql - ReneG - 15.12.2012

you have to store the field content into a string, and THEN convert it into a float using floatstr()

pawn Код:
new content[10];
cache_get_field_content(0, "pX", content, mysql_handle); EmpInfo[0][E_pX] = floatstr(content);



Re: Little help with float+mysql - Djole1337 - 15.12.2012

- delete nvm.