UpdatePos
#1

It does not load the database new position of the car !
My problem is the " WHERE ID " I am car database with ID : 1, and if I change " WHERE ID =% s " with " WHERE ID = 1 "then it works perfectly



Код HTML:
mysql_format(handle, query, sizeof(query), "UPDATE `vehicles` SET `PositionX` = '%f', `PositionY` = '%f', `PositionZ` = '%f', `Angle` = '%f' WHERE ID = '%i'", VehiclesInfo[carid][vPositionX], VehiclesInfo[carid][vPositionY], VehiclesInfo[carid][vPositionZ], VehiclesInfo[carid][vAngle], VehiclesInfo[carid][vID]);
mysql_query(handle, query);
Reply
#2

VehiclesInfo[carid][vID]

Is that the model id of the car? Or does it store the database ID?
Reply
#3

database ID
Reply
#4

how do you use"VehiclesInfo[carid][vID]", try to print it's value while executing the query for debugging.
Reply
#5

I dit it:
Код HTML:
printf("%i", VehiclesInfo[carid][vID]);
Log:
Код HTML:
[06:01:51] 0
Reply
#6

Got it, Databases ids start with one, loops start with 0, to fix this equal them, by increasing the loop by 1
pawn Код:
VehiclesInfo[carid][vID] ++;
mysql_format(handle, query, sizeof(query), "UPDATE `vehicles` SET `PositionX` = '%f', `PositionY` = '%f', `PositionZ` = '%f', `Angle` = '%f' WHERE ID = '%i'", VehiclesInfo[carid][vPositionX], VehiclesInfo[carid][vPositionY], VehiclesInfo[carid][vPositionZ], VehiclesInfo[carid][vAngle], VehiclesInfo[carid][vID]);
mysql_query(handle, query);
and is that the only output you got ?. you're probably not looping through correctly them or that's all the vehicles you're saving ?
Reply
#7

does not work..
Reply
#8

pawn Код:
VehiclesInfo[carid][vID] ++;
printf("%d", VehiclesInfo[carid][vID]);
mysql_format(handle, query, sizeof(query), "UPDATE `vehicles` SET `PositionX` = '%f', `PositionY` = '%f', `PositionZ` = '%f', `Angle` = '%f' WHERE ID = '%i'", VehiclesInfo[carid][vPositionX], VehiclesInfo[carid][vPositionY], VehiclesInfo[carid][vPositionZ], VehiclesInfo[carid][vAngle], VehiclesInfo[carid][vID]);
mysql_query(handle, query);
Also show what's in your mysql_log.txt.
Reply
#9

Log:
Код HTML:
[06:56:52] 1
I always show number one . If for example I car with ID 2 of the database and give / park, it changes my data from one machine ID it would be correct to change my data from machine ID: 2
Reply
#10

Probably VehiclesInfo[carid][vID] is not loading as it should..
Can you show loading part..?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)