SA-MP Forums Archive
cache_field_content_int probleme - invalid datatype - 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: cache_field_content_int probleme - invalid datatype (/showthread.php?tid=662744)



cache_field_content_int probleme - invalid datatype - None1337 - 10.01.2019

I'm getting this in mysql_log https://gyazo.com/a388e3ed8474ed8a1e8d18e704c31d29 every time when I run this query:

Код:
format(str, sizeof(str), "SELECT SUM(`seconds`) FROM `user_times` WHERE `playerid` = %d;", PlayerInfo[playerid][pSQLID]);
mysql_tquery(SQL, str, "checkSeconds", "i", playerid);

forward checkseconds(playerid);
public checkseconds(playerid)
{
   if(!cache_num_rows()) return SCM(playerid, -1, "You have 0 seconds played!");
   
   new seconds = cache_get_field_content_int(0, "SUM(`seconds`)");
   
   va_SendClientMessage(playerid, -1, "You have %d seconds played!", seconds);

   return 1;
}
What is wrong??


Re: cache_field_content_int probleme - invalid datatype - iorp - 10.01.2019

here is your solution.

https://sampwiki.blast.hk/wiki/MySQL#ca...value_name_int


Re: cache_field_content_int probleme - invalid datatype - None1337 - 11.01.2019

Quote:
Originally Posted by iorp
Посмотреть сообщение
error 017: undefined symbol "cache_get_value_name_int"

I'm using MySQL R39-5.


Re: cache_field_content_int probleme - invalid datatype - Banditul18 - 11.01.2019

PHP код:
format(strsizeof(str), "SELECT SUM(`seconds`) as TotalSeconds FROM `user_times` WHERE `playerid` = %d;"PlayerInfo[playerid][pSQLID]);
new 
seconds cache_get_field_content_int(0"TotalSeconds"); 
If you had searched "mysql sum" on g00gle first result would have been a W3School link with an example for the query


Re: cache_field_content_int probleme - invalid datatype - None1337 - 22.01.2019

Quote:
Originally Posted by Banditul18
Посмотреть сообщение
PHP код:
format(strsizeof(str), "SELECT SUM(`seconds`) as TotalSeconds FROM `user_times` WHERE `playerid` = %d;"PlayerInfo[playerid][pSQLID]);
new 
seconds cache_get_field_content_int(0"TotalSeconds"); 
If you had searched "mysql sum" on g00gle first result would have been a W3School link with an example for the query
I've already did that.


Re: cache_field_content_int probleme - invalid datatype - None1337 - 25.01.2019

with mysql log all as HTML: https://i.gyazo.com/986f318dc43b46ed...ed1ba2d018.png

bump


Re: cache_field_content_int probleme - invalid datatype - Wanheda - 25.01.2019

Is "TotalSeconds" datatype 'int'?


Re: cache_field_content_int probleme - invalid datatype - None1337 - 26.01.2019

Quote:
Originally Posted by Wanheda
Посмотреть сообщение
Is "TotalSeconds" datatype 'int'?
I think de mysql is returning the `TotalSeconds` an integer, and `player_seconds` is also a integer.


Re: cache_field_content_int probleme - invalid datatype - Calisthenics - 26.01.2019

https://i.gyazo.com/986f318dc43b46ed...ed1ba2d018.png

Third line. Data is "NULL" and not an integer value you expected, so something went wrong on saving.