Getting Saved Server Data (MySQL)
#1

pawn Код:
new IntRate;
new TaxRate;

stock GetInformation(info[], value)
{
    new query[128];
    format(query, sizeof(query),"SELECT * FROM `information` WHERE `info` = '%s'", info);
    mysql_query(query);
    mysql_store_result();

    while(mysql_fetch_row_format(query,"|"))
    {
        new tablevalue[16];
        mysql_fetch_field_row(tablevalue, "value"); value = strval(tablevalue);
    }
    mysql_free_result();
   
    return value;
}

public OnGameModeInit()
{
    GetInformation("interest", IntRate);
    GetInformation("tax", TaxRate);
       
        return 1;
}

//debug command
CMD:rates(playerid, params[])
{

    new string[128];
    format(string, 128, "Interest: %d%s", IntRate, "%%");
    SendClientMessage(playerid, COLOR_WHITE, string);
    format(string, 128, "Tax: %d%s", TaxRate, "%%");
    SendClientMessage(playerid, COLOR_WHITE, string);
   
    return 1;
}
It's returning 0 for both rates. What's wrong?
Reply


Messages In This Thread
Getting Saved Server Data (MySQL) - by austin070 - 28.08.2014, 20:52
Re: Getting Saved Server Data (MySQL) - by SchurmanCQC - 28.08.2014, 21:05
Re: Getting Saved Server Data (MySQL) - by austin070 - 28.08.2014, 21:10
Re: Getting Saved Server Data (MySQL) - by austin070 - 28.08.2014, 21:30

Forum Jump:


Users browsing this thread: 1 Guest(s)