Cookies stored in MySQL Database - Out of date


I am designing a shopping basket system which checks the users cookie on their computer with a list of cookieid’s stored in a MySQL database and hence reloads their shopping basket if they come back at a later date, which is a useful feature.

I foresee a problem. Each customer will have a cookie added to their computer which is automatically deleted after a set time (say 30 days). But the cookieid will not be deleted from my MySQL database. Is it common practice to manually delete entries in a MySQL database when using it for the basket system or is there a way to delete the entries which are ‘out-of-date’?



Manually? :eek:

You could add a column to the table, with the cookie creation date. Then you can periodically run a query that deletes all outdated rows.