Insert vehicle into DB ?
#1

Hello, can you help me with my script, the vehicle is not insert into my DB after a cmd /veh


check the code: https://pastebin.com/xmiZxbRp
Reply
#2

PHP Code:
mysql_format(dbhandlequerysizeof(query), "INSERT INTO `server_vehicles` SET Model='%d',Color1='%d',Color2='%d',PosX='%d',PosY='%d',PosZ='%d',PosA='%d'"
Here the format specifier is wrong, here posx, y, z and a have been declared as Float, therefore you need to follow the correct format.
here is the corrected line.
PHP Code:
mysql_format(dbhandlequerysizeof(query), "INSERT INTO `server_vehicles` SET Model='%d',Color1='%d',Color2='%d',PosX='%f',PosY='%f',PosZ='%f',PosA='%f'"
Reply
#3

Oh yeah exactly for %f , thank's, but , I have again the problem of insert
Reply
#4

Ah Sorry , didnt noticed that, you are using a wrong INSERT syntax read more here
Here is the corrected line
PHP Code:
mysql_format(dbhandlequerysizeof(query), "INSERT INTO `server_vehicles` (Model, Color1, Color2, PosX, PosY, PosZ, PosA)VALUES('%d', '%d', '%d', '%f', '%f', '%f', '%f')"Vehicle_infos[vehicleid][v_Model], Vehicle_infos[vehicleid][v_Color1], Vehicle_infos[vehicleid][v_Color2], Vehicle_infos[vehicleid][v_PosX], Vehicle_infos[vehicleid][v_PosY], Vehicle_infos[vehicleid][v_PosZ], Vehicle_infos[vehicleid][v_PosA]); 
Reply
#5

Ok bro ! But my syntax its ok with this cmd !

/pickup [ITS OKAY] > https://pastebin.com/1vkUgJam
/veh2 [WRONG] > https://pastebin.com/rD5s3vF3

Its correctly insert into db , and not with /veh, why ?
Reply
#6



Do what Debjit said above, he clearly explains you about the query.

Quote:
Originally Posted by Debjit
View Post
Ah Sorry , didnt noticed that, you are using a wrong INSERT syntax read more here
Here is the corrected line
PHP Code:
mysql_format(dbhandlequerysizeof(query), "INSERT INTO `server_vehicles` (Model, Color1, Color2, PosX, PosY, PosZ, PosA)VALUES('%d', '%d', '%d', '%f', '%f', '%f', '%f')"Vehicle_infos[vehicleid][v_Model], Vehicle_infos[vehicleid][v_Color1], Vehicle_infos[vehicleid][v_Color2], Vehicle_infos[vehicleid][v_PosX], Vehicle_infos[vehicleid][v_PosY], Vehicle_infos[vehicleid][v_PosZ], Vehicle_infos[vehicleid][v_PosA]); 
Reply
#7

Yeah but with this syntax, its again wrong
Reply
#8

what's wrong with those syntax? do you get any errors?
Reply
#9

No, no errors, just the line is not insert into DB
Reply
#10

Check MySQL Logs.its there in log folder.
Make sure you got mysql_log(ERROR | WARNING); or mysql_log(ALL); under OnGameModeInit.

I think you got some problems in your SendQuery Function, Can you show SendQuery Function.
or Maybe your callback parameters are not same as of the function.
Reply
#11

Ok i'm stupid lol, its okay bro !

But, the float position is not save , look

> http://prntscr.com/gzozhg
Reply
#12

Check your MySQL structure if they are assigned as float or not
Reply
#13

Yeah is float
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)