MySQL fetching row problem! [URGENT HELP]
#1

Hello!

So, today I decided to do the hardware ban system! Anyways, have done everything, but it seems that tinniest and easist part of MySQL/script f*** me up! If you know whats the problem here, please help me!

Here is the code:
pawn Код:
stock HWBan(playerid)
{
    new PNAME[MAX_PLAYER_NAME];
    GetPlayerName(playerid,PNAME,sizeof(PNAME));
    new PlayerIP[20];
    new phwid[MAX_PLAYERS];
    GetPlayerIp(playerid,PlayerIP,sizeof(PlayerIP));
    new hquery[100];
    format(hquery, sizeof(hquery), "SELECT * FROM hwuser WHERE name = '%s'", PNAME);
    mysql_query(hquery);
    mysql_store_result();
    while(mysql_fetch_row_format(hquery,"|"))
    {
        new hwstring[100];
        mysql_fetch_field_row(hwstring,"hwid"); phwid[playerid] = strval(hwstring);
    }
    mysql_free_result();
    new hquery2[200];
    format(hquery2, sizeof(hquery2), "INSERT INTO hwbans(name, hwid, IP) VALUES('%s', '%s', '%s')", PNAME, phwid[playerid], PlayerIP);
    mysql_query(hquery2);
    Kick(playerid);
    return 1;
}
And now look at the debug when I use HWBan:
Код:
[22:44:44] CMySQLHandler::Query(SELECT * FROM hwuser WHERE name = 'fiki574_CRO') - Successfully executed.

[22:44:44] >> mysql_store_result( Connection handle: 1 )

[22:44:44] CMySQLHandler::StoreResult() - Result was stored.

[22:44:44] >> mysql_fetch_row_format( Connection handle: 1 )

[22:44:44] CMySQLHandler::FetchRow() - Return: fiki574_CRO|00x01054716159|127.0.0.1

[22:44:44] >> mysql_fetch_field_row( Connection handle: 1 )

[22:44:44] CMySQLHandler::FetchField("hwid") - 00x01054716159 //this is number that I need, it is fetched here, but now look down

[22:44:44] >> mysql_fetch_row_format( Connection handle: 1 )

[22:44:44] >> mysql_free_result( Connection handle: 1 )

[22:44:44] CMySQLHandler::FreeResult() - Result was successfully free'd.

[22:44:44] >> mysql_query( Connection handle: 1 )

[22:44:45] CMySQLHandler::Query(INSERT INTO hwbans(name, hwid, IP) VALUES('fiki574_CRO', 'HWID HERE', '127.0.0.1')) - Successfully executed. //previous number (00x01054716159) should be instead of "HWID HERE" at "VALUES"
Can somebody help me??
Reply


Messages In This Thread
MySQL fetching row problem! [URGENT HELP] - by fiki574 - 15.04.2012, 20:44
Re: MySQL fetching row problem! [URGENT HELP] - by fiki574 - 16.04.2012, 08:33
Re: MySQL fetching row problem! [URGENT HELP] - by Roel - 16.04.2012, 09:47
Re: MySQL fetching row problem! [URGENT HELP] - by fordawinzz - 16.04.2012, 09:51
Re: MySQL fetching row problem! [URGENT HELP] - by fiki574 - 16.04.2012, 18:36
Re: MySQL fetching row problem! [URGENT HELP] - by AndreT - 16.04.2012, 18:45
Re: MySQL fetching row problem! [URGENT HELP] - by fiki574 - 16.04.2012, 18:51

Forum Jump:


Users browsing this thread: 3 Guest(s)