[Help]Problem with cache_get_row_int [ REP ++ ]
#1

I am trying to get a value for playerDays from my database but it's saying 0 in-game.
I am using mysql r39-2 and i am getting those errors in mysql_log:
pawn Код:
[21:46:57] [WARNING] cache_get_field_content - no active cache
My code is:
pawn Код:
else
                    {
                        new query2[1000];
                        new dstring[500];
                        new query[1000];
                        new days;
                                            new playerID = cache_get_row_int(0, 0);
                                            mysql_format(handle, query2, sizeof(query2), "SELECT `playerID` FROM `playeraccounts` WHERE `playerName` = '%s' LIMIT 1",playerVariables[playerid][pSelected]);
                                mysql_tquery(handle, query2);


                        mysql_format(handle, query, sizeof(query), "SELECT playerDays FROM playeraccounts WHERE playerID = '%d' ", playerID);
                        new Cache: result690 = mysql_query(handle, query);
                        cache_get_field_content(0, "playerDays", query2);
                        days = strval(query2);
                       
                        format(dstring, sizeof(dstring), "%s has left the faction with %d days.",playerVariables[playerid][pSelected], days);
                        SCM(playerid, -1 , dstring);
                       
                        cache_delete(result690);
                    }
Thanks for helping me! I rep!
Reply
#2

Try this, I've edited few lines
pawn Код:
else
{
    new query[1000],
        dstring[128],
        tmp[128];
       
    new days;
    new Cache:result690;
   
    mysql_format(handle, query, sizeof(query), "SELECT `playerID` FROM `playeraccounts` WHERE `playerName` = '%s' LIMIT 1",playerVariables[playerid][pSelected]);
    result690 = mysql_query(handle, query);
    playerID = cache_get_row_int(0, 0);
   
   
    mysql_format(handle, query, sizeof(query), "SELECT `playerDays` FROM `playeraccounts` WHERE `playerID` = '%d' ", playerID);
    result690 = mysql_query(handle, query);
    cache_get_field_content(0, "playerDays", tmp);
    days = strval(tmp);

    format(dstring, sizeof(dstring), "%s has left the faction with %d days.",playerVariables[playerid][pSelected], days), SCM(playerid, -1 , dstring);

    cache_delete(result690);
}
Reply
#3

PHP код:
else
{
    new 
query[200],param,Cache:cquery;
    
    
mysql_format(handlequerysizeof(query), "SELECT playerID FROM playeraccounts WHERE playerName = '%e' LIMIT 0,1",playerVariables[playerid][pSelected]);
    
cquery=mysql_query(handle,query);
    
param=cache_get_field_content_int(0,"playerID");
    
cache_delete(cuqery);
    
mysql_format(handle,querysizeof(query), "SELECT playerDays FROM playeraccounts WHERE playerID = '%d' LIMIT 0,1",param);
    
cquery=mysql_query(handle,query);
    
param=cache_get_field_content_int(0,"playerDays");
    
cache_delete(cquery);
    
format(query,sizeof(query),"%s has left the faction with %d days.",playerVariables[playerid][pSelected],param);
    
SCM(playerid,-1,query);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)