SA-MP Forums Archive
mysql - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: mysql (/showthread.php?tid=350403)



mysql - BaubaS - 12.06.2012

I have a problem, when loading server statistics, it always null. No error in debug.txt. I am using BlueG r7 plugin.

Saving:

pawn Код:
stock SaveStatistic()
{
    new szQuery[289];
    format(szQuery, 289, "UPDATE `statistika` SET `RekordoData` = '%s', `Saskaitos` = '%d', `Prisijungimai` = '%d', `Suimimai` = '%d', `Rekordas` = '%d', `DuotosBaudos` = '%d', `Ismetimai` = '%d', `Uzblokavimai` = '%d'",
    sInfo[szRecordDate], sInfo[iAccounts], sInfo[iConnects], sInfo[iArrests], sInfo[iRecord], sInfo[iFines], sInfo[iKicks], sInfo[iBans]);
    mysql_function_query(iHandle, szQuery, false, "", "");
}
Loading:

pawn Код:
#define LoadStatistic()          mysql_function_query(iHandle, "SELECT * FROM `statistika`", true, "OnServerStatisticLoad", "")
pawn Код:
PUB::OnServerStatisticLoad()
{
    new
        iFields,
        iRows;

    cache_get_data(iRows, iFields);
    if (iRows)
    {
        new szResult[12];
        cache_get_row(0, 0, sInfo[szRecordDate]);
        cache_get_row(0, 1, szResult); sInfo[iAccounts] = strval(szResult);
        cache_get_row(0, 2, szResult); sInfo[iConnects] = strval(szResult);
        cache_get_row(0, 3, szResult); sInfo[iArrests]  = strval(szResult);
        cache_get_row(0, 4, szResult); sInfo[iRecord]   = strval(szResult);
        cache_get_row(0, 5, szResult); sInfo[iFines]    = strval(szResult);
        cache_get_row(0, 6, szResult); sInfo[iKicks]    = strval(szResult);
        cache_get_row(0, 7, szResult); sInfo[iBans]     = strval(szResult);
    }
    return true;
}
PMA:




Re: mysql - AndreT - 12.06.2012

Start off by showing what data you have in the table.

And as far as I can tell from your code, it only loads one row. Is that what you're trying to achieve?

Also, please look into creating proper table structures with the right field sizes. I am no good at Lithuanian(?), but I can be quite sure that these values aren't up to 11 characters long.


Re: mysql - BaubaS - 12.06.2012

Quote:
Originally Posted by AndreT
Посмотреть сообщение
Start off by showing what data you have in the table.

And as far as I can tell from your code, it only loads one row. Is that what you're trying to achieve?

Also, please look into creating proper table structures with the right field sizes. I am no good at Lithuanian(?), but I can be quite sure that these values aren't up to 11 characters long.
What do you mean?

No, I want to load all fields. For the lenght, I will change it, ty


Re: mysql - BaubaS - 12.06.2012

up./


Re: mysql - BaubaS - 13.06.2012

le bump, really need this 2 fix