Jump to content

Filter Expired Classified Ad Listings


ppunk

Recommended Posts

Hi, I am setting up an area on my site where users can post their own items they want to sell or give away, similar to a classified ad. I am having problems setting it up so it filters only active items. I want to set up the form so it allows the user to choose how many days their listing will be online (similar to ebay), like 7, 14, or 28 days as an example. After their item listing is expired, I want it so it is taken off the main site and put into an archive database table.
The only way I can think of doing this is to either put the code on the main listing page so it is run everytime someone views that page, or to set up a cron job to run every once in awhile. Items don't need to be taken down immediately, so in the case of me setting up a cron job to run every 6 six hours to check for expired items would be fine.

My main problem is, setting up the SQL and PHP to accomplish all this. I have had some help from some great members here, but I am still having trouble getting this to work properly and more importantly, actually learning how it works.

In my items database table, here are the fields I have right now:
id, startDate, endDate, type, summary (there are some more fields but they are irrelevant here).

Any help or tips would be great!
Thanks for any help in advance.

-Steve
Link to comment
Share on other sites

I should have mentioned that I am not that advanced with php (yet). I am still learning little by little.
Is there anyway to explain a little more about how this can be done? You mentioned to do it as a time difference. Would it be a good idea to have the time included with the date? Right now my startDate and endDate are set up like this in my MySQL database: 2006-07-10.
Any help would be great.
Thanks for the reply!

-Steve
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.