Closed kutaskozla closed 6 years ago
Try this:
new query[512];
/*changed this*/ mysql_format(g_SQL, query, sizeof(query), "SELECT IFNULL(DATEDIFF(viptime,NOW()),'-1') AS vipdays,IFNULL(viptime,'0000-00-00') AS viptime WHERE `nick`='%e' LIMIT 1", PlayerName(playerid));
mysql_tquery(g_SQL, query, "OnPlayerDataLoaded", "dd", playerid, g_MysqlRaceCheck[playerid]);
forward OnPlayerDataLoaded(playerid, race_check);
public OnPlayerDataLoaded(playerid, race_check)
{
if (race_check != g_MysqlRaceCheck[playerid]) return Kick(playerid);
if(cache_num_rows() > 0)
{
/*and this*/ cache_get_value_int(0, "vipdays", pData[playerid][vipDaysLeft]);
cache_get_value(0, "viptime", pData[playerid][vipDate], 16);
/*and this*/ printf("%d %s", pData[playerid][vipDaysLeft], pData[playerid][vipToDate]);
//pData[playerid][cacheID] = cache_save();
}
return 1;
}
cache_get_value_int
from viptime
, which is of type DATE
I guess, also tried on the same column with cache_get_value
.pData[playerid][vipDays]
but you printed pData[playerid][vipDaysLeft]
.mysql_log( ERROR | WARNING )
and check it in the future!Not sure if it will work as you want, but that's better than your code.
Also, as me and @maddinat0r said tons of times: This isn't an issue with the MySQL Plugin! Post your questions on the forum! GitHub Issues is for project's issues/suggestions, not for your regular questions.
Why are the values downloaded 65535 0000-00-00 ?
vip
date NOT NULL DEFAULT '0000-00-00',in the database I have set the vip field 20 days ahead there is more data in the query, but they are downloaded well, there is only a somewhere IFNULL