Hi, Am building a car sale site.I want to automatically take of listings that are more than, say 14 day old.
Any php/mysql scripts or an idea as to how to do this?
php function to count days every day
Page 1 of 14 Replies - 167 Views - Last Post: 22 January 2012 - 06:17 AM
Topic Sponsor:
Replies To: php function to count days every day
#2
Re: php function to count days every day
Posted 17 January 2012 - 02:38 AM
there are two possible routes in general.
1) make a MySQL function/procedure that only returns those valid listings
2) specify it in the fetching SQL string. something along SELECT item FROM listings WHERE DATE_ADD(item_created, INTERVAL 14 DAY) > NOW()
1) make a MySQL function/procedure that only returns those valid listings
2) specify it in the fetching SQL string. something along SELECT item FROM listings WHERE DATE_ADD(item_created, INTERVAL 14 DAY) > NOW()
This post has been edited by Dormilich: 17 January 2012 - 02:40 AM
#3
Re: php function to count days every day
Posted 17 January 2012 - 01:58 PM
Thank you for your help.I need one for clarification,is this
Thank you for your help.I need one more clarification,is this
item_createda filed in the db as well?
Thank you for your help.I need one more clarification,is this
[b]item_created[/b]a filed in the db as well? If so what data type will it be, Date type?
#4
Re: php function to count days every day
Posted 17 January 2012 - 02:29 PM
it’s the data field where you store the date/time when you created the listing. it would be sensible to define it along
item_created TIMESTAMP DEFAULT CURRENT_TIMESTAMP
#5
Re: php function to count days every day
Posted 22 January 2012 - 06:17 AM
Hi Dormilich, am very thankful for your help,it worked just perfect,thanks alot
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|