[MySQL] "cache_get_field_content_int" no active cache
#6

Quote:
Originally Posted by Faisal_khan
View Post
Hi guys,

Well this is my code:
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);
LoadAccount:
pawn Code:
forward LoadAccount(playerid);
public LoadAccount(playerid)
{
    new rows, fields;
    cache_get_data(rows, fields);
    PlayerInfo[playerid][IP] = cache_get_field_content_int(0, "IP");
}
I tried using mysql_function_query, still no luck.

Regards.
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.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)