SA-MP Forums Archive
MYSQL listing - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MYSQL listing (/showthread.php?tid=520481)



MYSQL listing - edzis84 - 19.06.2014

Hello everyone, i'm having a following problem.

When i'm ingame creating an apartment it creates it into database with id 1.
When i delete this apartment and create once a gain it creates it into database with id 2. even if i have nothing else in there. And because of that I can't dynamic manage my apartment because ingame it shows his id as one but mysql id is 2. How to get this fixed?


Re: MYSQL listing - Firewire - 19.06.2014

Then you must do a SELECT statement to see if anyone's apartment ID corresponds to the deleted apartment and set it to 0. Then your problem will not exist any more.

Hope that helps.
- Firewire.


Re: MYSQL listing - RajatPawar - 19.06.2014

I assume the ID field is auto incrementing. So an easy solution for you now is, add a field called 'deleted', set it to 1 when you want to delete an apartment, and just rewrite over it when you want to create a new one over it. This is the one of the most easiest solutions you can manage given you have already scripted it, right? This also provides the advantage of being able to undo any deletions you did by mistake.