[ERROR] cache_get_row_count: no active cache
#1

Hi guys, i got this error in my mysql.log
Код:
[23:24:09] [ERROR] cache_get_row_count: no active cache (D:\SAMPSERVER\Roleplay\pawno\include\a_mysql.inc:182 -> Stock/stock.pwn:48 -> Publics/ODR/registerlogin.pwn:21)
And this is my code

PHP код:
AssignPlayerData(playerid); // LINE: 21 (This code is only for calling AssignPlayerData) 
PHP код:
stock AssignPlayerData(playerid)
{
    new 
rows cache_num_rows(); //Error line: 48
    
if(rows)
    {
        new 
loaded;
        while(
loaded rows)
        {
            
cache_get_value_int(loaded"id"pInfo[playerid][ID]);
            
cache_get_value_int(loaded"kills"pInfo[playerid][pKills]);
            
cache_get_value_int(loaded"deaths"pInfo[playerid][pDeaths]);
            
cache_get_value_int(loaded"admin"pInfo[playerid][pAdmin]);
            
cache_get_value_int(loaded"vip"pInfo[playerid][pVIP]);
            
cache_get_value_int(loaded"money"pInfo[playerid][pMoney]);
            
cache_get_value_float(loaded"x"pInfo[playerid][X_Pos]);
            
cache_get_value_float(loaded"y"pInfo[playerid][Y_Pos]);
            
cache_get_value_float(loaded"z"pInfo[playerid][Z_Pos]);
            
cache_get_value_float(loaded"angle"pInfo[playerid][A_Pos]);
            
cache_get_value_int(loaded"interior"pInfo[playerid][pInterior]);
            
loaded++;
        }
    }
    
GivePlayerMoney(playeridpInfo[playerid][pMoney]);
    return 
1;

Can you guys help me? Thankss!
Reply
#2

Don't use stock.

Код:
    new rows;
    cache_get_row_count(rows);
Reply
#3

You call a function and then expect it to retrieve data when there is no active cache (no query executed).
You have to select the data for the player and then call the function. Take a look at example script:
https://github.com/pBlueG/SA-MP-MySQ...cache.pwn#L182
https://github.com/pBlueG/SA-MP-MySQ...cache.pwn#L312

It however stores cache in memory and sets active for later use instead of executing another query.
Reply
#4

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
Don't use stock.

Код:
    new rows;
    cache_get_row_count(rows);
Okayy i'll try that!
Reply
#5

So is it going to be like this?
PHP код:
AssignPlayerData(playerid)
{
    new 
rows;
    
cache_get_row_count(rows);
    if(
rows)
    {
        new 
loaded;
        while(
loaded rows)
        {
            
cache_get_value_int(loaded"id"pInfo[playerid][ID]);
            
cache_get_value_int(loaded"kills"pInfo[playerid][pKills]);
            
cache_get_value_int(loaded"deaths"pInfo[playerid][pDeaths]);
            
cache_get_value_int(loaded"admin"pInfo[playerid][pAdmin]);
            
cache_get_value_int(loaded"vip"pInfo[playerid][pVIP]);
            
cache_get_value_int(loaded"money"pInfo[playerid][pMoney]);
            
cache_get_value_float(loaded"x"pInfo[playerid][X_Pos]);
            
cache_get_value_float(loaded"y"pInfo[playerid][Y_Pos]);
            
cache_get_value_float(loaded"z"pInfo[playerid][Z_Pos]);
            
cache_get_value_float(loaded"angle"pInfo[playerid][A_Pos]);
            
cache_get_value_int(loaded"interior"pInfo[playerid][pInterior]);
            
loaded++;
        }
    }
    
GivePlayerMoney(playeridpInfo[playerid][pMoney]);
    return 
1;

Reply
#6

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
You call a function and then expect it to retrieve data when there is no active cache (no query executed).
You have to select the data for the player and then call the function. Take a look at example script:
https://github.com/pBlueG/SA-MP-MySQ...cache.pwn#L182
https://github.com/pBlueG/SA-MP-MySQ...cache.pwn#L312

It however stores cache in memory and sets active for later use instead of executing another query.
Ohh I got it! Thank you for your help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)