SQL Error?
#1

I am trying to add a vehicle plate to cars, but it isn't working properly. It is saving 5 characters to 'carPlate' in the database, but it is also setting the values of 'carLocked', 'carParked' and 'carWorld' to random numbers between 10-99. I can't figure out why it's doing this, it was working just fine before but now, all of a sudden, it's setting stuff it shouldn't be.

This is the function which creates cars and sets its values...
PHP код:
PlayerCar_Create(owneridmodelidFloat:xFloat:yFloat:zFloat:anglecolor1color2)
{
    for (new 
0!= MAX_DYNAMIC_CARS++)
    {
        if (!
CarData[i][carExists])
           {
               if (
color1 == -1)
                   
color1 random(127);
            if (
color2 == -1)
                
color2 random(127);
               
CarData[i][carExists] = true;
            
CarData[i][carModel] = modelid;
            
CarData[i][carOwner] = ownerid;
            
CarData[i][carPos][0] = x;
            
CarData[i][carPos][1] = y;
            
CarData[i][carPos][2] = z;
            
CarData[i][carPos][3] = angle;
            
CarData[i][carColor1] = color1;
            
CarData[i][carColor2] = color2;
            
CarData[i][carPaintjob] = -1;
            
CarData[i][carLocked] = false;
            
CarData[i][carParked] = 0;
            
CarData[i][carWorld] = 0;
            
CarData[i][carImpounded] = -1;
            
CarData[i][carImpoundPrice] = 0;
            
            new 
str[8];
            
format(strsizeof(str), "%s%s%d%d%s%s%s"LetterList[random(sizeof(LetterList))], LetterList[random(sizeof(LetterList))], random(10), random(10), LetterList[random(sizeof(LetterList))], LetterList[random(sizeof(LetterList))], LetterList[random(sizeof(LetterList))]);
            
SetVehicleNumberPlate(istr);
            
format(CarData[i][carPlate], 11"%s"str);
        
            
mysql_function_query(g_iHandle"INSERT INTO `playercars` (`carModel`) VALUES(0)"false"OnPlayerCarCreated""d"i);
            return 
i;
        }
    }
    return -
1;
}
forward OnPlayerCarCreated(carid);
public 
OnPlayerCarCreated(carid)
{
    if (
carid == -|| !CarData[carid][carExists])
        return 
0;
    
CarData[carid][carID] = mysql_insert_id();
    
PlayerCar_Save(carid);
    return 
1;

It's inserting everything into the database fine, except the plate... here's a screenshot...


Am I using INSERT INTO wrong?
Reply


Messages In This Thread
SQL Error? - by adamslj - 25.08.2017, 15:00
Re: SQL Error? - by Vince - 25.08.2017, 15:27
Re: SQL Error? - by adamslj - 25.08.2017, 15:46
Re: SQL Error? - by adamslj - 25.08.2017, 16:06
Re: SQL Error? - by thegamer355 - 25.08.2017, 16:52
Re: SQL Error? - by adamslj - 25.08.2017, 17:31
Re: SQL Error? - by adamslj - 25.08.2017, 18:25
Re: SQL Error? - by Vince - 25.08.2017, 18:32
Re: SQL Error? - by thegamer355 - 25.08.2017, 18:39
Re: SQL Error? - by adamslj - 25.08.2017, 19:20

Forum Jump:


Users browsing this thread: 1 Guest(s)