CallBackFunction MYSQL cached
#7

Your queries are completly wrong, no use of "," at places, no "`" to enclose columns and so one...
I suggest you to go through a basic syntax tutorial on SQL. Can be found anywhere on ******.

Here is the correct way and you don't need to use a callback for that, because mysql_tquery returns 1 or 0 for success and fail.
pawn Код:
case factionnamed:
{
    new bool:success = true;

    format(Player[playerid[FactionName], 120, inputtext);

    new query[200];
    mysql_format(mysql, query, sizeof (query), "INSERT INTO `faction` (`factionname`) VALUES ('%e')", inputtext);
    if (mysql_tquery(mysql, query) == 0)
        success = false;

    mysql_format(mysql, query, sizeof (query), "UPDATE `accounts` SET `factionname` = '%e', `factionid` = %d WHERE `ID` =  %d LIMIT 1", Player[playerid][FactionName], Faction[playerid][ID], Player[playerid][ID]);
    if (mysql_tquery(mysql, query) == 0)
        success = false;

    if (success)
    {
        // Every thing went well
        ShowPlayerDialog(playerid, factiontyped, DIALOG_STYLE_LIST, "FACTION CREATION", "Type 0(Drugs)\nType 1(Weapons)", "Choose","Cancel");
    }
    else
    {
        // Either a new row in "faction" table wasn't created or `accounts` wasn't updated
    }
}
Reply


Messages In This Thread
CallBackFunction MYSQL cached - by DavidLuango - 30.07.2016, 09:29
Re: CallBackFunction MYSQL cached - by DavidLuango - 30.07.2016, 16:13
Re: CallBackFunction MYSQL cached - by Gammix - 30.07.2016, 16:19
Re: CallBackFunction MYSQL cached - by DavidLuango - 30.07.2016, 16:41
Re: CallBackFunction MYSQL cached - by DavidLuango - 30.07.2016, 16:54
Re: CallBackFunction MYSQL cached - by DavidLuango - 30.07.2016, 18:03
Re: CallBackFunction MYSQL cached - by Gammix - 30.07.2016, 18:36
Re: CallBackFunction MYSQL cached - by Konstantinos - 30.07.2016, 19:02
Re: CallBackFunction MYSQL cached - by Gammix - 30.07.2016, 19:12
Re: CallBackFunction MYSQL cached - by DavidLuango - 30.07.2016, 21:05

Forum Jump:


Users browsing this thread: 1 Guest(s)