MySQL INSERT INTO/UPDATE.
#1

Hello guys. I'm trying to save my faction information.

PHP код:
CMD:createfaction(playerid,params[])
{
    if(
Player[playerid][Admin] < 4) return SendClientMessage(playeridCOLOR_GREY"You must be an adminstrator to use this command");
    
ShowPlayerDialog(playeridfactionnamedDIALOG_STYLE_INPUT"Faction Creation""Enter the faction name below""Next");
    return 
1;

Under Enumerators I have.
PHP код:
enum FactionData
{
    
ID,
    
factionname,
    
factiontype
};
new 
Faction[MAX_PLAYERS][FactionData]; 
PHP код:
enum
{
    
LoginDialog,
    
RegisterDialog,
    
factionnamed,
    
factiontyped,
    
}; 
Under OnDialogResponse I have.

PHP код:
case factionnamed:
        {
            new 
query[500];
            
mysql_format(mysql,query,sizeof(query), "INSERT INTO `faction` (`factionname`,`factiontype`) VALUES ('%e')",inputtext);
            
mysql_tquery(mysqlquery"""");
            
ShowPlayerDialog(playeridfactiontypedDIALOG_STYLE_LIST"FACTION CREATION""Type 0(Drugs)\nType 1(Weapons)""Choose","Cancel");
            if(
dialogid == factiontyped)
            {
                if(
response)
                {
                    switch(
listitem)
                    {
                        
//mysql_format(mysql,query,sizeof(query), "UPDATE `accounts` SET `Admin` = %d WHERE ID = %d LIMIT 1",  level, Player[target][ID]);
                        
case 0:
                        {
                            
mysql_format(mysqlquery,sizeof(query), "UPDATE `faction` SET `factiontype` = '0' WHERE ID = %d LIMIT 1"Faction[playerid][ID]);
                            
mysql_tquery(mysqlquery"""");
                        }
                        
                        case 
1:
                        {
                             
mysql_format(mysqlquery,sizeof(query), "UPDATE `faction` SET `factiontype` = '1' WHERE ID = %d LIMIT 1"Faction[playerid][ID]);
                            
mysql_tquery(mysqlquery"""");
                        }
                    }
                }
            }
        } 
For some reason my faction name/type doesn't save. What am I doing wrong?
Reply


Messages In This Thread
MySQL INSERT INTO/UPDATE. - by DavidLuango - 30.07.2016, 05:33
Re: MySQL INSERT INTO/UPDATE. - by Ahmed21 - 30.07.2016, 07:45
Re: MySQL INSERT INTO/UPDATE. - by Shinja - 30.07.2016, 11:32

Forum Jump:


Users browsing this thread: 1 Guest(s)