sscanf split problem
#1

Ok so i have the following DB

id|Name|Password|Admin|Money|LastLogin|Banned|BanT ime|MotivBan

and this code
pawn Код:
enum PlayerInfo
{
    id, // integer
    Name[24],
    Password[24],
    Admin,
    Money,
    LastLogin[24],
    Banned, // integer 1 or 0
    BanTime, // string , as day/month/year/hour/minute
    MotivBan, // reason for ban , string

}
new PInfo[MAX_PLAYERS][PlayerInfo];
and the spliting
pawn Код:
format(Query, sizeof(Query), "SELECT * FROM `Users` WHERE `Name` = '%s' ", pName);
mysql_query(1,Query);
mysql_store_result();
mysql_fetch_row_format(Query, "|");
sscanf(Query, "e<p<|>is[24]s[24]iis[24]is[24]s[24]>", PInfo[playerid]);
printf("%s",PInfo[playerid][MotivBan]);
Strangely it outputs me
Код:
[07:17:46] 5/2/2015/5/3
Here is the data in the DB
Reply
#2

You said BanTime and MotivBan are strings, even though they're not arrays in your enum but integers.
Reply
#3

Ty very much mate .
Lack of sleep certanly makes you miss the little stuff
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)