Help in MYSQL Command
#8

Try this, it's using cache:
Код:
CMD:checkbolo(playerid, params[])
{
    new vehicleid;
    if(sscanf(params, "d", vehicleid)) return SendClientMessage(playerid, COLOR_GREY, "[CMD]: /checkbolo [vehicleid]");
    if(playerinfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_ERROR, MUTED_ERROR);
    if(playerinfo[playerid][pLogado] == 0) return SendClientMessage(playerid, COLOR_ERROR, LOGIN_ERROR);
    format(query, sizeof(query), "SELECT Bolo FROM `vehicleinfo` WHERE ID = %d",vehicleid);
    mysql_function_query(MYSQLConnection, query, true, "BoloReturnMessage", "d", playerid);
    SendClientMessage(playerid, COLOR_GREY, "Returning Bolo from database:");
    return 1;
}
forward BoloReturnMessage(playerid);
public BoloReturnMessage(playerid)
{
    new rows, fields;
    cache_get_data(rows, fields);
    if(Rows != 0)
    {
        new content[1];
		new bstring[128], bolo;
        cache_get_field_content(0, "Bolo", content);
        bolo = strval(content);
        format(bstring, sizeof(bstring), "Bolo: %s", bolo);
    	SendClientMessage(playerid, COLOR_GREY, bstring);
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "Failed to retrieve info from the database.");
    }
	format(string, sizeof(string), "Bolo: %s", query);
    SendClientMessage(playerid, COLOR_GREY, query);
}
It should work.
Reply


Messages In This Thread
Help in MYSQL Command - by willttoonn - 06.10.2013, 01:30
Re: Help in MYSQL Command - by willttoonn - 06.10.2013, 02:44
Re: Help in MYSQL Command - by DaTa[X] - 06.10.2013, 03:02
Re: Help in MYSQL Command - by willttoonn - 06.10.2013, 03:13
Re: Help in MYSQL Command - by -Prodigy- - 06.10.2013, 03:49
Re: Help in MYSQL Command - by willttoonn - 06.10.2013, 04:09
Re: Help in MYSQL Command - by willttoonn - 06.10.2013, 22:10
Re: Help in MYSQL Command - by NeTSk8 - 07.10.2013, 15:57

Forum Jump:


Users browsing this thread: 1 Guest(s)