Mysql problem
#1

Hi, i have a small mysql problem, so my accounts doesn't load , i have check mysql log i have find this ( i'am using mysql on PPC_Trucking )

pawn Код:
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "StatsAssistance", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Level", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "VIP", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Jailed", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Bans", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "BanTime", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "TruckerLicense", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "BusLicense", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "PilotLicense", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "MafiaLicense", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Team", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Leader", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_float - row: 0, field_name: "StatsMetersDriven", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_float - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "StatsTruckerJobs", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "StatsConvoyJobs", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "StatsBusDriverJobs", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "StatsPilotJobs", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "StatsMafiaJobs", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "StatsMafiaStolen", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "StatsPoliceFined", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "StatsPoliceJailed", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "StatsCourierJobs", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "StatsRoadworkerJobs", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Money", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Score", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "RulesRead", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Muted", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Minutesjouer", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
[15:22:57] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Heuresjouer", connection: 1
[15:22:57] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('0')
[15:22:57] [ERROR] cache_get_field_content_int - invalid datatype
my code

PHP код:
public PlayerFile_Load(playerid)
{
    
APlayerData[playerid][StatsAssistance] = cache_get_field_content_int(0"StatsAssistance");
    
APlayerData[playerid][PlayerLevel] = cache_get_field_content_int(0"Level");
    
APlayerData[playerid][VIPLevel] = cache_get_field_content_int(0"VIP");
    
APlayerData[playerid][PlayerJailed] = cache_get_field_content_int(0"Jailed");
    
APlayerData[playerid][Bans] = cache_get_field_content_int(0"Bans");
    
APlayerData[playerid][BanTime] = cache_get_field_content_int(0"BanTime");
    
APlayerData[playerid][TruckerLicense] = cache_get_field_content_int(0"TruckerLicense");
    
APlayerData[playerid][BusLicense] = cache_get_field_content_int(0"BusLicense");    
    
APlayerData[playerid][PilotLicense] = cache_get_field_content_int(0"PilotLicense");    
    
APlayerData[playerid][MafiaLicense] = cache_get_field_content_int(0"MafiaLicense");    
    
APlayerData[playerid][Team] = cache_get_field_content_int(0"Team");    
    
APlayerData[playerid][Leader] = cache_get_field_content_int(0"Leader");
    
APlayerData[playerid][StatsMetersDriven] = cache_get_field_content_float(0"StatsMetersDriven");
    
APlayerData[playerid][StatsTruckerJobs] = cache_get_field_content_int(0"StatsTruckerJobs");
    
APlayerData[playerid][StatsConvoyJobs] = cache_get_field_content_int(0"StatsConvoyJobs");
    
APlayerData[playerid][StatsBusDriverJobs] = cache_get_field_content_int(0"StatsBusDriverJobs");
    
APlayerData[playerid][StatsPilotJobs] = cache_get_field_content_int(0"StatsPilotJobs");
    
APlayerData[playerid][StatsMafiaJobs] = cache_get_field_content_int(0"StatsMafiaJobs");
    
APlayerData[playerid][StatsMafiaStolen] = cache_get_field_content_int(0"StatsMafiaStolen");
    
APlayerData[playerid][StatsPoliceFined] = cache_get_field_content_int(0"StatsPoliceFined");
    
APlayerData[playerid][StatsPoliceJailed] = cache_get_field_content_int(0"StatsPoliceJailed");
    
APlayerData[playerid][StatsCourierJobs] = cache_get_field_content_int(0"StatsCourierJobs");
    
APlayerData[playerid][StatsRoadworkerJobs] = cache_get_field_content_int(0"StatsRoadworkerJobs");
    
APlayerData[playerid][PlayerMoney] = cache_get_field_content_int(0"Money");
    
APlayerData[playerid][PlayerScore] = cache_get_field_content_int(0"Score");
    
APlayerData[playerid][RulesRead] = cache_get_field_content_int(0"RulesRead");
    
APlayerData[playerid][Muted] = cache_get_field_content_int(0"Muted");
    
    
APlayerData[playerid][pMinutes] = cache_get_field_content_int(0"Minutesjouer");
    
APlayerData[playerid][pHeures] = cache_get_field_content_int(0"Heuresjouer");
    
printf("SERVER STATS : AN ACCOUNT HAVE BEEN LOADED.");
    return 
1;

Thx for advance.
Reply
#2

anyone please?
Reply
#3

Have you downloaded MySQL r39 plugin and added it to your server folders and recompiled your script?
Reply
#4

Can you show me the query which is executed?
The row which the script is trying to retrieve doesn't exist in the database.
Reply
#5

@will yes, i have the compatible version ( mysql R39-2)

@Chlorine yes check

PHP код:
public OnAccountCheck(playerid)
{
    new 
rowsfieldsstring[240], plrIP[16];
    
GetPlayerIp(playeridplrIPsizeof(plrIP));
    
cache_get_data(rowsfieldsg_iHandle);
    if(
rows//if there is row
    
{
        
cache_get_field_content(0"Password"APlayerData[playerid][PlayerPassword], g_iHandle129);
        
APlayerData[playerid][CompteID] = cache_get_field_content_int(0"ID");
        
printf("MDP CHARGE : %s"APlayerData[playerid][PlayerPassword]);
        
format(string2000TXT_DialogLoginMsgGetPlayerNameEx(playerid), plrIP);
        
ShowPlayerDialog(playeridDialogLoginDIALOG_STYLE_PASSWORDTXT_DialogLoginTitlestringTXT_DialogLoginButton1TXT_DialogButtonCancel);
    }
    else
    {
        new 
strStartRules[2000];
                
// RULES TEXT
        
ShowPlayerDialog(playeridDialogStartRulesDIALOG_STYLE_MSGBOX"Rиglement du serveur"strStartRules"Refuser""Accepter");
    }
    
printf("ETAT DU SERVEUR : CHECK D'UN COMPTE");
    return 
1;

Query :
PHP код:
    mysql_format(g_iHandlequerysizeof(query),"SELECT `Password`, `ID` FROM `users` WHERE `PlayerName` = '%e' LIMIT 1"GetPlayerNameEx(playerid));
    
mysql_tquery(g_iHandlequery"OnAccountCheck""i"playerid); 
Dialog response :

PHP код:
// Process the login-dialog
Dialog_Login(playeridresponseinputtext[])
{
    switch (
response// Check which button was clicked
    
{
        case 
1// Player clicked "Login"
        
{
            
// Check if the player entered a password
            
if (strlen(inputtext) > 0)
            {
                new 
query[100]; // for formatting our query.
                
if(!strcmp(inputtextAPlayerData[playerid][PlayerPassword])) 
                { 
                    
mysql_format(g_iHandlequerysizeof(query), "SELECT * FROM `users` WHERE `ID` = '%d' LIMIT 1"APlayerData[playerid][CompteID]);
                    
mysql_tquery(g_iHandlequery"PlayerFile_Load""i"playerid);
                    
                    
mysql_format(g_iHandlequerysizeof(query), "SELECT * FROM `bank` WHERE `ID` = '%d' LIMIT 1"APlayerData[playerid][CompteID]);
                    
mysql_tquery(g_iHandlequery"BankFile_Load""i"playerid);
                    
format(querysizeof(query), "UPDATE `users` SET `LoggedIN` = '1' WHERE `ID` = %d"APlayerData[playerid][CompteID]);
                    
mysql_format(g_iHandlequerysizeof(query), "%s"query);
                    
mysql_tquery(g_iHandlequery); 
    
                    
APlayerData[playerid][LoggedIn] = true;
                }
                else
                {
                    
ShowPlayerDialog(playeridDialogLoginDIALOG_STYLE_PASSWORDTXT_DialogLoginTitleTXT_LoginEnterPasswordWrongTXT_DialogLoginButton1TXT_DialogButtonCancel);
                }
                return 
1;
            }
            else
            {
                
SendClientMessage(playerid0xFFFFFFFFTXT_WrongPassword);
                
KickEx(playerid);
            }
        }
        case 
0// Player clicked "Cancel"
        
{
            
// Show a message that the player must be logged in to play on this server
            
SendClientMessage(playerid0xFFFFFFFFTXT_PlayerMustLogin);
            
// Kick the player
            
KickEx(playerid);
        }
    }
    return 
1;

Reply
#6

Check your database table. Clearly check if you have a row with that user id.
Reply
#7

i'am succesfully logged in with my password
Reply
#8

Try to debug it:
pawn Код:
public OnAccountCheck(playerid)
{
    new rows, fields, string[240], plrIP[16];
    GetPlayerIp(playerid, plrIP, sizeof(plrIP));
    cache_get_data(rows, fields, g_iHandle);
    printf("Rows: %i, Fields: %i", rows, fields);
    if(rows) //if there is row
    {
        cache_get_field_content(0, "Password", APlayerData[playerid][PlayerPassword], g_iHandle, 129);
        APlayerData[playerid][CompteID] = cache_get_field_content_int(0, "ID");
        printf("MDP CHARGE : %i: %s", APlayerData[playerid][Compte], APlayerData[playerid][PlayerPassword]);
        format(string, 2000, TXT_DialogLoginMsg, GetPlayerNameEx(playerid), plrIP);
        ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, TXT_DialogLoginTitle, string, TXT_DialogLoginButton1, TXT_DialogButtonCancel);
    }
    else
    {
        new strStartRules[2000];
                // RULES TEXT
        ShowPlayerDialog(playerid, DialogStartRules, DIALOG_STYLE_MSGBOX, "Rиglement du serveur", strStartRules, "Refuser", "Accepter");
    }
    printf("ETAT DU SERVEUR : CHECK D'UN COMPTE");
    return 1;
}
I've made 2 debugs (one already existed; Password).
Show me what it prints on the console.
Reply
#9

i have got : 1 rows and 2 fields

MDP CHARGE: 9: test
Reply
#10

Alright then, show me your database (users table).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)