SA-MP Forums Archive
MySQL Won't update a text after saving information. - 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 Won't update a text after saving information. (/showthread.php?tid=629768)



MySQL Won't update a text after saving information. - TheLeech - 03.03.2017

So when a player requests an application it saves the player's name and first question answer, After saving I go to the MySQL Applications and the other question answers haven't been set, Anyhelp?

Код:
public OnPlayerText(playerid, text[])
{
    if(GetPVarInt(playerid, "AppMade") == 0) {
        if(GetPVarInt(playerid, "Questions") == 1)
        {
            SendClientMessage(playerid, 0x00FF00FF, "Question 2: What does OOC and IC stand for?");
            SetPVarInt(playerid, "Questions", 2);
            new querylist[256];
            mysql_format(mysql, querylist, sizeof(querylist), "INSERT INTO `applications` (`Name`, `Question1`, `Accepted`)\
			VALUES ('%e', '%e', 0)", PlayerInfo[playerid][Name], text);
			mysql_query(mysql, querylist);
            return 0;
        }
        if(GetPVarInt(playerid, "Questions") == 2)
        {
            SendClientMessage(playerid, 0x00FF00FF, "Question 3: What does PG mean and what is it?");
            SetPVarInt(playerid, "Questions", 3);
            new querylist[256];
    		mysql_format(mysql, querylist, sizeof(querylist), "UPDATE `applications` SET `Question2` = %e WHERE `Name` = '%e'" , text, PlayerInfo[playerid][Name]);
    		mysql_query(mysql, querylist);
            return 0;
        }
        if(GetPVarInt(playerid, "Questions") == 3)
        {
            SendClientMessage(playerid, 0x00FF00FF, "Question 4: What is Revenge Killing?");
            SetPVarInt(playerid, "Questions", 4);
            new querylist[256];
    		mysql_format(mysql, querylist, sizeof(querylist), "UPDATE `applications` SET `Question3` = %e WHERE `Name` = '%e'" , text, PlayerInfo[playerid][Name]);
    		mysql_query(mysql, querylist);
            return 0;
        }
        if(GetPVarInt(playerid, "Questions") == 4)
        {
            SendClientMessage(playerid, 0x00FF00FF, "Question 5: Give an example of a /do command?");
            SetPVarInt(playerid, "Questions", 5);
            new querylist[256];
    		mysql_format(mysql, querylist, sizeof(querylist), "UPDATE `applications` SET `Question4` = %e WHERE `Name` = '%e'" , text, PlayerInfo[playerid][Name]);
    		mysql_query(mysql, querylist);
            return 0;
        }
        if(GetPVarInt(playerid, "Questions") == 5)
        {
            SendClientMessage(playerid, 0x00FF00FF, "Question 6: What does PG mean and what is it?");
            SetPVarInt(playerid, "Questions", 6);
            new querylist[256];
    		mysql_format(mysql, querylist, sizeof(querylist), "UPDATE `applications` SET `Question5` = %e WHERE `Name` = '%e'" , text, PlayerInfo[playerid][Name]);
    		mysql_query(mysql, querylist);
            return 0;
        }
        if(GetPVarInt(playerid, "Questions") == 6)
        {
            new str[128];
            new pName[24];
            SendClientMessage(playerid, 0x00FF00FF, "Server: Thank you for taking the quiz, A member of staff will review it shortly.");
            SetPVarInt(playerid, "Questions", 0);
            GetPlayerName(playerid, pName, 24);
            SetPVarInt(playerid, "AppMade", 1);
            SetPVarInt(playerid, "AppPassed", 0);
            new querylist[256];
    		mysql_format(mysql, querylist, sizeof(querylist), "UPDATE `applications` SET `Question6` = %e WHERE `Name` = '%e'" , text, PlayerInfo[playerid][Name]);
    		mysql_query(mysql, querylist);
    		LoadApplications();
			GiveNameSpace(ApplicationInfo[playerid][Name]);
			format(str, sizeof(str), "Server: New application to be reviewed posted by %s (%d) (/applications).", pName, playerid);
			SendAdminMessage(COLOR_ORANGE, str);
            return 0;
        }
    }
	return 1;
}



Re: MySQL Won't update a text after saving information. - Edwin2801 - 03.03.2017

Because U must do so:
'%e'
when U save a text


Re: MySQL Won't update a text after saving information. - TheLeech - 03.03.2017

Quote:
Originally Posted by Edwin2801
Посмотреть сообщение
Because U must do so:
'%e'
when U save a text
oh my god i'm so dumb thank you.


Re: MySQL Won't update a text after saving information. - Edwin2801 - 03.03.2017

Forget it)