SA-MP Forums Archive
MySQL auto delete if more than 5 rows - 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 auto delete if more than 5 rows (/showthread.php?tid=476776)



MySQL auto delete if more than 5 rows - dusk - 20.11.2013

Okay, I want to keep records of the last 5 people the person called, but I don't want useless rows in my database either.

I stumbled upon "Trigers" in MySQL, so is it possible to add a trigger AFTER "Insert" queries that would delete the oldest row(I keep the current timestamp when they are added).

Note: I know this is more MySQL related than Pawn, but I'm still posting this here to let people suggest other ways and etc.

I know I could just send a query AFTER the insert one, to count the rows and delete the last one, but I just want to know if my described way is possible.