Mysql doesn't insert player data to database
#1

Hi guys, I'm learning MySQL and I get this error. I'm doing a registration system with MySQL to save the player data. But the problem is when the player register, it doesn't insert anything to my database.
PHP Code:
new pName[MAX_PLAYER_NAME], query[256];
    
GetPlayerName(playeridpNamesizeof(pName));
    
mysql_format(MHandlequerysizeof(query), "SELECT * FROM `character` WHERE `Username` = '%e' LIMIT 1"pName);
    
mysql_query(MHandlequery);
    new 
rows;
    
cache_get_row_count(rows);
    if(!
rows){
        
System_Scm(playeridCOLOR_YELLOW"REGISTER""You can register.");
        
//SetupCharacter(playerid);    
        
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD"Registration""Fill your password into the box below""Okay""Cancel");
    } 
PHP Code:
case DIALOG_REGISTER:{
            if(
response){
                if(!
response) return Kick(playerid); 
                if(!
strlen(inputtext) || strlen(inputtext) > 100){
                    
System_Scm(playeridCOLOR_RED"ERROR""Password must be at least 5 words and lower than 100 words.");
                    
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD"Registration""Fill your password into the box below to register your account""Ok""Cancel");
                } 
                else if(
strlen(inputtext) > && strlen(inputtext) < 100
                {
                    new 
pName[MAX_PLAYER_NAME], query[256];
                    new 
Cache:GetCache;
                    
GetPlayerIp(playeridCharacter[playerid][IP], 16);
                    
mysql_format(MHandlequerysizeof(query), "INSERT INTO `character` (`Username`, `Password`, `Level`, `Money`, `IP`, `posX`, `posY`, `posZ`, `posA`, `Health`, `Armour`) VALUES ('%s', 'SHA1(%s)', (1), (10000), '%s', (1958.3783), (1343.1572), (15.3746), (90.0), (100.0), (0.0))"pNameinputtextCharacter[playerid][IP]);
                    
GetCache mysql_query(MHandlequery);
                    
cache_delete(GetCache);
                    
System_Scm(playeridCOLOR_YELLOW"REGISTERED""You have registered succesfully!");
                    
SpawnPlayer(playerid);
                }
            }
        } 
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)