cache_field_content_int probleme - invalid datatype
#1

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

here is your solution.

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

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

I'm using MySQL R39-5.
Reply
#4

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

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

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

bump
Reply
#7

Is "TotalSeconds" datatype 'int'?
Reply
#8

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)