MySQL no active cache issue
#2

Code:
LoadAvailableBounties(playerid)
{
    new DB_Query[256];
    mysql_format(Database, DB_Query, sizeof(DB_Query), "SELECT * FROM `player_bounties`");
    mysql_tquery(Database, DB_Query, "LoadBounties", "i", playerid);
    printf("%s", DB_Query); // the query is printed correctly
}

forward LoadBounties(playerid);
public LoadBounties(playerid)
{
    if(cache_num_rows()>0) // the error line is here and fairly enough, only the first entry is shown in the dialog
    {
        new target, hitprice;
        for(new i; i<cache_num_rows(); i++)
        {
            cache_get_value_int(i, "hitid", target);
            cache_get_value_int(i, "amount", hitprice);
            // some more code not mysql related
        }
    }
    return 1;
}

CMD:bounties(playerid, params[])
{
    LoadAvailableBounties(playerid);
    return 1;
}
PHP Code:
LoadAvailableBounties(playerid)
{
    new 
DB_Query[450];
    
mysql_format(DatabaseDB_Querysizeof(DB_Query), "SELECT * FROM `player_bounties`");
    
mysql_tquery(DatabaseDB_Query"LoadBounties""i"playerid);
    
printf("%s"DB_Query);
}
function 
LoadBounties(playerid)
{
    new 
Rows;
    
cache_get_row_count(Rows);
   
    if(!
Rows
         return 
true;
 
    new 
targethitprice;
    for(new 
ii<Rowsi++)
    {
        
cache_get_value_int(i"hitid"target);
        
cache_get_value_int(i"amount"hitprice);
        
// some more code not mysql related
    
}
    return 
1;

Try that maybe. Also, what is player_bounties and what you want to get from that table? If you wanna get information related to the player typing command bounties use:
PHP Code:
LoadAvailableBounties(playerid)
{
    new 
DB_Query[256];
    
mysql_format(DatabaseDB_Querysizeof(DB_Query), "SELECT * FROM `player_bounties` WHERE `ID` = %d"PlayerInfo[playerid][SQLID]); // replace playerinfo with your player variables and `ID` to the id column in your table. Hope you understood.
    
mysql_tquery(DatabaseDB_Query"LoadBounties""i"playerid);
    
printf("%s"DB_Query); // the query is printed correctly

Reply


Messages In This Thread
MySQL no active cache issue - by Adamoneoone - 09.05.2020, 09:58
Re: MySQL no active cache issue - by BaFFyJunior - 09.05.2020, 12:18
Re: MySQL no active cache issue - by Adamoneoone - 09.05.2020, 12:48
Re: MySQL no active cache issue - by Calisthenics - 09.05.2020, 13:13
Re: MySQL no active cache issue - by Adamoneoone - 09.05.2020, 13:24
Re: MySQL no active cache issue - by Calisthenics - 09.05.2020, 13:27
Re: MySQL no active cache issue - by Adamoneoone - 09.05.2020, 13:31
Re: MySQL no active cache issue - by Calisthenics - 09.05.2020, 13:36
Re: MySQL no active cache issue - by Adamoneoone - 09.05.2020, 14:37

Forum Jump:


Users browsing this thread: 1 Guest(s)