Help in MYSQL Command
#1

I need a script that check the information contained in the row Bolo, I had one but it did not work.


pawn Код:
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 = '",vehicleid,"'");
    mysql_function_query(MYSQLConnection, query, false, "noReturnQuery", "d", playerid);
    format(string, sizeof(string), "Bolo: %s", query);
    SendClientMessage(playerid, COLOR_GREY, query);
    return 1;
}
Reply
#2

Someone?
Reply
#3

pawn Код:
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, false, "noReturnQuery", "d", playerid);
    format(string, sizeof(string), "Bolo: %s", query);
    SendClientMessage(playerid, COLOR_GREY, query);
    return 1;
}
Reply
#4

Quote:
Originally Posted by DaTa[X]
Посмотреть сообщение
pawn Код:
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, false, "noReturnQuery", "d", playerid);
    format(string, sizeof(string), "Bolo: %s", query);
    SendClientMessage(playerid, COLOR_GREY, query);
    return 1;
}
Not work man,

the message SELECT FROM Bolo `vehicleinfo` WHERE id =% d; S
Reply
#5

pawn Код:
format(query, sizeof(query), "SELECT Bolo FROM `vehicleinfo` WHERE ID = %d", vehicleid);
I also suggest you look into cached queries
Reply
#6

Quote:
Originally Posted by -Prodigy-
Посмотреть сообщение
pawn Код:
format(query, sizeof(query), "SELECT Bolo FROM `vehicleinfo` WHERE ID = %d", vehicleid);
I also suggest you look into cached queries
Error =S



I need an script with function of read these rows in table vehicleinfo.


You need more informations? you can ask me xD
Reply
#7

Someone?
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)