#1

Hello everyone. I have a problem with loading data from MySQL.. I dont get any error in the script, also there's no errors in Debug.txt.. But, looks like there's something wrong. I dont get my money, score, wanted level or anything else that Im loading.. It looks like all loaded fields are null, but as debug.txt says - its not.

pawn Код:
stock UzkrautiProfili(playerid)
{
    new Query[70], Eilute[45], Vardas[MAX_PLAYER_NAME], Float: fX, Float: fY, Float: fZ;
    GetPlayerName(playerid, Vardas, MAX_PLAYER_NAME);
   
    mysql_format      (_, Query, "SELECT * FROM `zaidejai` WHERE `Vardas` = '%e'", Vardas);
    mysql_query       (Query);
    mysql_store_result();
    while (mysql_fetch_row_format(Query, "|"))
    {
        mysql_fetch_field_row(Eilute, "Pinigai"); GivePlayerMoney(playerid, strval(Eilute));
        mysql_fetch_field_row(Eilute, "Patirtis"); SetPlayerScore(playerid, strval(Eilute));
        mysql_fetch_field_row(Eilute, "Ieskomumas"); SetPlayerWantedLevel(playerid, strval(Eilute));
        mysql_fetch_field_row(Eilute, "Prazaides"); pData[playerid][Prazaides] = strval(Eilute);
        mysql_fetch_field_row(Eilute, "Skin"); SetPlayerSkin(playerid, strval(Eilute));
        mysql_fetch_field_row(Eilute, "PozicijaX"); fX = floatstr(Eilute);
        mysql_fetch_field_row(Eilute, "PozicijaY"); fY = floatstr(Eilute);
        mysql_fetch_field_row(Eilute, "PozicijaZ"); fZ = floatstr(Eilute);
    }
    mysql_free_result();
    SetPlayerPos     (playerid, fX, fY, fZ);
   
    pData[playerid][Busena] = 2;
    return true;
}
Quote:

[11:59:13] CMySQLHandler::Query(SELECT * FROM `zaidejai` WHERE `Vardas` = 'BaubaS') - Successfully executed.

[11:59:13] >> mysql_store_result( Connection handle: 1 )

[11:59:13] CMySQLHandler::StoreResult() - Result was stored.

[11:59:13] >> mysql_fetch_row_format( Connection handle: 1 )

[11:59:13] CMySQLHandler::FetchRow() - Return: apseisi|BaubaS|127.0.0.1|3|12124|1000|0|2011-12-27 00:00:00|0|193|-35.3177|147.572|3.03328

[11:59:13] >> mysql_fetch_field_row( Connection handle: 1 )

[11:59:13] CMySQLHandler::FetchField("Pinigai") - 12124

[11:59:13] >> mysql_fetch_field_row( Connection handle: 1 )

[11:59:13] CMySQLHandler::FetchField("Patirtis") - 1000

[11:59:13] >> mysql_fetch_field_row( Connection handle: 1 )

[11:59:13] CMySQLHandler::FetchField("Ieskomumas") - 0

[11:59:13] >> mysql_fetch_field_row( Connection handle: 1 )

[11:59:13] CMySQLHandler::FetchField("Prazaides") - 0

[11:59:13] >> mysql_fetch_field_row( Connection handle: 1 )

[11:59:13] CMySQLHandler::FetchField("Skin") - 193

[11:59:13] >> mysql_fetch_field_row( Connection handle: 1 )

[11:59:13] CMySQLHandler::FetchField("PozicijaX") - -35.3177

[11:59:13] >> mysql_fetch_field_row( Connection handle: 1 )

[11:59:13] CMySQLHandler::FetchField("PozicijaY") - 147.572

[11:59:13] >> mysql_fetch_field_row( Connection handle: 1 )

[11:59:13] CMySQLHandler::FetchField("PozicijaZ") - 3.03328

[11:59:13] >> mysql_fetch_row_format( Connection handle: 1 )

[11:59:13] >> mysql_free_result( Connection handle: 1 )

[11:59:13] CMySQLHandler::FreeResult() - Result was successfully free'd.

Reply
#2

Debug your code:
pawn Код:
mysql_format      (_, Query, "SELECT * FROM `zaidejai` WHERE `Vardas` = '%e'", Vardas);
    mysql_query       (Query);
    mysql_store_result();
    print(Query);
pawn Код:
mysql_fetch_field_row(Eilute, "Pinigai"); printf("Pinigai: %d", Eilute);
etc..
Reply
#3

pawn Код:
stock UzkrautiProfili(playerid)
{
    new Query[70], Eilute[45], Vardas[MAX_PLAYER_NAME], Float: fX, Float: fY, Float: fZ;
    GetPlayerName(playerid, Vardas, MAX_PLAYER_NAME);
   
    mysql_format      (_, Query, "SELECT * FROM `zaidejai` WHERE `Vardas` = '%e'", Vardas);
    mysql_query       (Query);
    mysql_store_result();
    while(mysql_retrieve_row())
    {
        mysql_fetch_field_row(Eilute, "Pinigai"); GivePlayerMoney(playerid, strval(Eilute));
        mysql_fetch_field_row(Eilute, "Patirtis"); SetPlayerScore(playerid, strval(Eilute));
        mysql_fetch_field_row(Eilute, "Ieskomumas"); SetPlayerWantedLevel(playerid, strval(Eilute));
        mysql_fetch_field_row(Eilute, "Prazaides"); pData[playerid][Prazaides] = strval(Eilute);
        mysql_fetch_field_row(Eilute, "Skin"); SetPlayerSkin(playerid, strval(Eilute));
        mysql_fetch_field_row(Eilute, "PozicijaX"); fX = floatstr(Eilute);
        mysql_fetch_field_row(Eilute, "PozicijaY"); fY = floatstr(Eilute);
        mysql_fetch_field_row(Eilute, "PozicijaZ"); fZ = floatstr(Eilute);
    }
    mysql_free_result();
    SetPlayerPos     (playerid, fX, fY, fZ);
   
    pData[playerid][Busena] = 2;
    return true;
}
Try this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)