[HELP] mysql - UPDATE with strcat
#1

Hi ! I have to create a mysql line but it's too long.

How i can made it with strcat?

Код:
				new querystr[1000];
                format(querystr, sizeof(querystr), "UPDATE vehicleinfo SET Owner = 'none', Plate = 'plate', xc = '%f', yc = '%f', zc = '%f', ac = '%f', Color1 = '1', Color2 = '1', Locked = '0', Exploded = '0', Paintjob = '255', mod1 = '0', mod2 = '0', mod3 = '0', mod4 = '0', mod5 = '0', mod6 = '0', mod7 = '0', mod8 = '0', mod9 = '0', mod10 = '0', mod11 = '0', mod12 = '0', mod13 = '0', mod14 = '0', mod15 = '0', mod16 = '0', mod17 = '0'  WHERE ID = '%d'",
                    VehicleSystem[vehicleid][xc],
                    VehicleSystem[vehicleid][yc],
                    VehicleSystem[vehicleid][zc],
                    VehicleSystem[vehicleid]][ac],
		    		vehicleid
		    	);
                mysql_function_query(1, querystr, false, "", "");
Reply
#2

You don't need strcat for that:
pawn Код:
format(querystr, sizeof(querystr), "UPDATE vehicleinfo SET Owner = 'none', Plate = 'plate', xc = %f, yc = %f, zc = %f, ac = %f, Color1 = 1, Color2 = 1, Locked = 0, Exploded = 0, Paintjob = 255,",
    VehicleSystem[vehicleid][xc], VehicleSystem[vehicleid][yc], VehicleSystem[vehicleid][zc], VehicleSystem[vehicleid]][ac]);
format(querystr, sizeof(querystr), "%smod1 = 0, mod2 = 0, mod3 = 0, mod4 = 0, mod5 = 0, mod6 = 0, mod7 = 0, mod8 = 0, mod9 = 0, mod10 = 0, mod11 = 0, mod12 = 0, mod13 = 0, mod14 = 0, mod15 = 0, mod16 = 0, mod17 = 0  WHERE ID = %d",
    querystr, vehicleid);
But why do you set most of the values manually?
Reply
#3

Thanks. Because i know the variables
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)