cache_insert_id return 0 :x
#10

pawn Код:
mysql_format(MySQLConnect, query, 1024, "INSERT INTO `vehs` (`ModelID`, `PosX`, `PosY`, `PosZ`, `PosA`, `Couleur1`, `Couleur2`) VALUES (%d, '%f', '%f', '%f', '%f', %d, %d)", VehInfo[entry][ModelID], VehInfo[entry][Pos][0], VehInfo[entry][Pos][1], VehInfo[entry][Pos][2], VehInfo[entry][Pos][3], couleur1, couleur2);

mysql_tquery(MySQLConnect, query, "OnVehicleCreated", "i", entry);
for your VehInfo array, add "VID" , vehicle id which we are gonna store in the mysql database.
now on The "OnVehicleCreated" Callback part:
pawn Код:
forward OnVehicleCreated(entry);
public OnVehicleCreated(entry)
{
     VehInfo[entry][VID] = cache_insert_id(); // here, we set the vehicle id in this variable, and the mysql VID field, which we're gonna add later.
     printf("%i", VehInfo[entry][VID]); // debugging.
}
Now, the mysql part.
After launching your XAMP program to start the localhost to access the mysql database, go to vehicles table,
and Add a new field called "VID" , In index, (while you are creating it) , put "PRIMARY", and enable "A_I", that's required for a UID in every MySQL table.
an example in this tut: https://sampforum.blast.hk/showthread.php?tid=485633 , look at the 8th picture.
now you are done, check mysql_log.txt for any notices / errors returned.
Reply


Messages In This Thread
cache_insert_id return 0 :x - by Baltimore - 31.12.2014, 02:38
Re: cache_insert_id return 0 :x - by M4D - 31.12.2014, 04:52
Respuesta: cache_insert_id return 0 :x - by Zume - 31.12.2014, 05:35
Re: cache_insert_id return 0 :x - by AdmBot - 31.12.2014, 06:06
Re : cache_insert_id return 0 :x - by Baltimore - 31.12.2014, 11:40
Re: cache_insert_id return 0 :x - by Lordzy - 31.12.2014, 11:44
Re : cache_insert_id return 0 :x - by Baltimore - 31.12.2014, 12:15
Re : cache_insert_id return 0 :x - by Baltimore - 31.12.2014, 20:58
Re : cache_insert_id return 0 :x - by Dark_Rider29 - 01.01.2015, 13:34
Re: cache_insert_id return 0 :x - by Sawalha - 01.01.2015, 13:54

Forum Jump:


Users browsing this thread: 1 Guest(s)