I am trying to make a coupon system, but I got stuck with something. I want to make a function that gets all data from coupon_session where the time (datetime) is older than 30 minutes. For each of the results, I want to fetch the "code" from the row, and after that I want it to delete the row.
I've already figured out how to retrieve the data, but the rest is kinda hard for me. Could you guys help a bit?
This is my code for fetching all > 30 min old rows:
mysql_query("GET * FROM `coupon_session` WHERE TIMESTAMPDIFF(MINUTE,time,NOW()) > 30");