[MySQL] "cache_get_field_content_int" no active cache
#10

Quote:
Originally Posted by Kar
View Post
That's not true.


And maybe the guy has multiple connections?

pawn Code:
SendClientMessage(playerid, COLOR_YELLOW, "You have succesfully logged in!");
IsLogged[playerid] = 1;
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `playerdata` WHERE `Name` = '%e' LIMIT 1", PlayerInfo[playerid][name]);
mysql_tquery(mysql, query, "LoadAccount", "d", playerid);

forward LoadAccount(playerid);
public LoadAccount(playerid)
{
    new rows = cache_num_rows();
    if(!rows) {
        printf("[DATABASE ERROR]: Account does not exist.");
    }
    else if(rows == 1) {
        PlayerInfo[playerid][IP] = cache_get_field_content(0, "IP", PlayerInfo[playerid][IP], mysql, 17);
    }
    else if(rows > 1) {
        printf("[DATABASE ERROR]: Multiple accounts matching player %d.", playerid);
    }
}
No, only one connection. It is still giving me the "no active cache" warning. And no errors.

Quote:
Originally Posted by iZN
View Post
Oh right I almost forgot!

pawn Code:
format(szQuery, sizeof(szQuery), "%s", PlayerInfo[playerid][IP]);
cache_get_field_content(0, "IP", szQuery);
Still same problem.

Quote:
Originally Posted by KtotheYle
View Post
pawn Code:
forward LoadAccount(playerid);
public LoadAccount(playerid)
{
    new rows, fields;
    cache_get_data(rows, fields);
    if(rows)
    {
         //This runs if there is data in the DB
         cache_get_field_content(0, "IP", PlayerInfo[playerid][IP], .max_len = 44);
    }
    else
    {
        //If nothing is there
     }
}
You were trying to get IP as a int, which it is not because it has decimals, nor is it a float because there are multiple decimals, so your easiest way is to make it a string. You could also do this

GetPlayerIp(playerid, PlayerInfo[playerid][IP], 44);

Also make sure that the max length of your IP is the same as what is described as your maxlength.
Still same problem. Yeah I modified the code for the string.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)