0

I am trying to work out with PHP session and what I want to do is to expire my orders saved in the database after a 30 minutes of inactivity on the order made without payment been completed.

My Questions

  1. How do I create session to specifically handle the orders in my database?
  2. How to destroy session {id} generated specifically for orders when 30mins of inactivity is due?

Just need ideas on how to complete that.

Harry
  • 87,580
  • 25
  • 202
  • 214
bernardk23
  • 11
  • 5

1 Answers1

0

i want to do is to expire my orders saved in the database after a 30 minutes of inactivity on the order made without payment been completed-

Use cron job .

if you are using database tables to store order information, it will be easy for you to run a cron job, which will run every minute (or every 30 secs, or every 15 secs etc) and will disable/delete all the orders which are inactive from last 30 minutes.

This way disabling inactive orders will also be automatised as well.

Refer this link for looking how to create a cron.

No need to use sessions if you have to do the above task only.

Community
  • 1
  • 1
Hirdesh Vishwdewa
  • 2,334
  • 1
  • 19
  • 33