Extract Problem!
#1

Not extract information correctly form database!
Код HTML:
mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM `players` WHERE `user` = '%e' LIMIT 1", GetName(playerid));
            mysql_tquery(MySQLCon, query, "OnPlayerLogin", "i", playerid);
Код HTML:
forward OnPlayerLogin(playerid);
public OnPlayerLogin(playerid)
{
   // bla bla bla
    pInfo[playerid][pFpunish] = cache_get_field_content_int(0, "Fpunish");
    return 1;
}
DEBUG:
Код HTML:
printf("DEBUG: %d", pInfo[playerid][pFpunish]);
DEBUG: 1
pInfo[playerid][pFpunish] in database is 0, not 1.
Reply
#2

Bump!
Reply
#3

The error could be when she makes the query.

You do a query and calls the function with Tquery but never checked if the query return data.

Try.

PHP код:
forward OnPlayerLogin(playerid);
public 
OnPlayerLogin(playerid)
{
    if(
cache_num_rows() != 0// This will check if the query return data.
    
{
        
pInfo[playerid][pFpunish] = cache_get_field_content_int(0"Fpunish");
    }
    return 
1;

Reply
#4

x3378 not work your version of script...
Reply
#5

Try this:

PHP код:
mysql_format(MySQLConquerysizeof(query), "SELECT * FROM `players` WHERE `user` = '%d' LIMIT 1"GetName(playerid));
            
mysql_tquery(MySQLConquery"OnPlayerLogin""i"playerid); 
It should work now.
Reply
#6

Is "pFpunish" a boolean type variable? If so, add "!!" before "cache_get_field_content_int" function.
pawn Код:
pInfo[playerid][pFpunish] = !!cache_get_field_content_int(0, "pFpunish", MySQLCon);
Reply
#7

"pFpunish" is not boolean variable.
Код HTML:
enum PlayerInfo
{
     pFpunish, pWarns //.... etc
}
new pInfo[MAX_PLAYERS][PlayerInfo];
Reply
#8

Debug cache_get_field_content_int(0, "pFpunish", MySQLCon); using printf function and see what's it's value. I've encountered something similar like this while using "BIT" datatype for my column, currently MySQL plugin don't support BIT datatype.
Reply
#9

The problem happens and other variables. It changes value...
Exemple:
"pInfo[playerid][pLeader]" the server -> pLeader = 8.
"pLeader" in database -> pLeader = 1.
Correctly is 1!
Reply
#10

You may have a buffer overflow somewhere. Run crashtdetect. Also check the debug logs.
Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)