Problem:-
I want to show only those Documents which are before the deadline of the page.
when deadline equals or less than the currentdate then show
else move to archive or send to archive file.

How to write a code for this or a query ?
as for understanding , Picture is attached.

Code for the above mentioned problem is required if possible.
THanks,

My deadline field in database is deadline and current date variable is $curdate

you can create two separate pages for say
1) current
2) archive

the difference is only in query

for current

select * from tablename where deadline>current_date()

for archive

select * from tablename where deadline<=current_date()