Mysql Error , Need Quick Help
#1

Hy, guys I am new in samp programming and currently working on MySQL..

My SQL connection is working but its not getting player data....

PHP код:
stock LoadAccount(playerid)
{
    new 
query[128], P_Name[24], savingdata[20];
    
GetPlayerName(playeridP_Namesizeof(P_Name));
    
format(querysizeof(query), "SELECT * FROM p_data WHERE username = '%s'"P_Name);
    
mysql_query(query);
    
mysql_store_result();
    
mysql_fetch_field_row(savingdata"score"); SetPlayerScore(playeridstrval(savingdata));
    
mysql_fetch_field_row(savingdata"money"); GivePlayerMoney(playerid,strval(savingdata));
    
mysql_fetch_field_row(savingdata"adminlevel");P_Var[playerid][p_Adminlevel] = strval(savingdata);
    
mysql_free_result();
    return 
1;

MySQL DEBUG file....
Код:
[23:25:21] >> mysql_real_escape_string( Connection handle: 1 )

[23:25:21] CMySQLHandler::EscapeString(shahab); - Escaped 6 characters to shahab.

[23:25:21] >> mysql_query( Connection handle: 1 )

[23:25:21] CMySQLHandler::Query(SELECT userid FROM `p_data` WHERE `username` = 'G_Rana_G' AND password = 'shahab' LIMIT 1) - Successfully executed.

[23:25:21] >> mysql_store_result( Connection handle: 1 )

[23:25:21] CMySQLHandler::StoreResult() - Result was stored.

[23:25:21] >> mysql_query( Connection handle: 1 )

[23:25:21] CMySQLHandler::Query(SELECT userid FROM `p_data` WHERE `username` = 'G_Rana_G' AND password = 'shahab' LIMIT 1) - Successfully executed.

[23:25:21] >> mysql_num_rows( Connection handle: 1 )

[23:25:21] CMySQLHandler::NumRows() - Returned 1 row(s)

[23:25:21] >> mysql_query( Connection handle: 1 )

[23:25:21] CMySQLHandler::Query(SELECT score,money,adminlevel FROM p_data WHERE username = 'G_Rana_G') - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now)

[23:25:21] >> mysql_store_result( Connection handle: 1 )

[23:25:21] CMySQLHandler::StoreResult() - Result was stored.

[23:25:21] >> mysql_fetch_field_row( Connection handle: 1 )

[23:25:21] CMySQLHandler::FetchField(score) - You cannot call this function now. (Reason: Fields/Rows are empty.)

[23:25:21] >> mysql_fetch_field_row( Connection handle: 1 )

[23:25:21] CMySQLHandler::FetchField(money) - You cannot call this function now. (Reason: Fields/Rows are empty.)

[23:25:21] >> mysql_fetch_field_row( Connection handle: 1 )

[23:25:21] CMySQLHandler::FetchField(adminlevel) - You cannot call this function now. (Reason: Fields/Rows are empty.)

[23:25:21] >> mysql_free_result( Connection handle: 1 )

[23:25:21] CMySQLHandler::FreeResult() - Result was successfully free'd.

[23:25:21] >> mysql_free_result( Connection handle: 1 )

[23:25:21] CMySQLHandler::FreeResult() - The result is already empty.

Here?
Код:
[23:25:21] CMySQLHandler::Query(SELECT score,money,adminlevel FROM p_data WHERE username = 'G_Rana_G') - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now)

[23:25:21] >> mysql_store_result( Connection handle: 1 )

[23:25:21] CMySQLHandler::StoreResult() - Result was stored.

[23:25:21] >> mysql_fetch_field_row( Connection handle: 1 )

[23:25:21] CMySQLHandler::FetchField(score) - You cannot call this function now. (Reason: Fields/Rows are empty.)
And Here MySQL is working for me....


PHP код:
case D_LOGIN:
        {
            if(
response)
            {
                new 
query[128],P_Name[24],rows,escpass[24];
                
GetPlayerName(playerid,P_Name,sizeof(P_Name));
                
//GetPlayerIp(playerid,P_IP,sizeof(P_IP));
                
mysql_real_escape_string(inputtextescpass);
                
format(query,sizeof(query),"SELECT userid FROM `p_data` WHERE `username` = '%s' AND password = '%s' LIMIT 1",P_Name,escpass);
                
mysql_query(query);
                
mysql_store_result();
                
rows mysql_num_rows(mysql_query(query));
                if(
rows == 1)
                {
                
LoadAccount(playerid);
                
SendClientMessage(playerid,C_WHITE,"Account Succesfully LoggedIn!");
                
GameTextForPlayer(playerid"~g~WelCome Back!",500,1);
                
IsLogged[playerid] = 1;
                
mysql_free_result();
                }
                else { 
SendClientMessage(playerid,C_WHITE,"Wrong Password!"); }
            }
            else { 
SendClientMessage(playerid,C_WHITE,"Kicked :p!"); }
    } 
Reply
#2

Any one , who can help me ??
Reply
#3

*bump*
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)