amol
amol

Reputation: 47

I want to hide the details of record (of database) from user when date will be expired using php

I'm totally new to php & mysql, When I'm creating one trial application using php ,there is problem specify below, I want to hide the details of record (of database) from user when date will be expired using php ,

When one user logedin & create one record entry that time automatically current date is also entered in database, but I want to give 1 week expiry date, after that the record will be not shown to the front end but it available in database. When the creator of this record renew this recod that time automatically date should be updated at current date, & same record will be shown as new entry

PLz help me, I'm waiting for ur answer, Thanks in advance.

Upvotes: 0

Views: 571

Answers (1)

Christian
Christian

Reputation: 3988

What kind of column is the date one? Timestamp? or timedate?

Either way, you can do it like so (depending on your column type) For timedate:

WHERE (date + INTERVAL 1 WEEK) < CURDATE()

For timestamp:

WHERE (timestamp + 604800) < UNIX_TIMESTAMP()

Let me know what you are using for your date column and I can update. You can also see the MySQL date functions here.

Upvotes: 1

Related Questions