Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,156,713 members, 7,831,238 topics. Date: Friday, 17 May 2024 at 03:56 PM |
Nairaland Forum / Idealws's Profile / Idealws's Posts
(1) (of 1 pages)
Webmasters / Re: Writing A Time Based Expiration Script Or Function Using Php And Mysql by Idealws: 10:07am On May 28, 2009 |
Hello, Well this is my first post so i hope this is helpful. I noticed the $x variable is being incremented by one regardless of if it is a expired add or not. This is fixable by removing the ++$x; and putitng it in the if() statement like below:
I added a field to my database called numberdays to set the expire time to a different one depending on the add. Here is my finished code in case it helps anyone.
Here is my table for this code: CREATE TABLE IF NOT EXISTS `listings` ( `id` bigint(20) NOT NULL auto_increment, `vid` bigint(20) NOT NULL, `sectionid` varchar(20) NOT NULL, `datestarted` varchar( NOT NULL, `numberdays` tinyint(4) NOT NULL, `status` varchar(25) NOT NULL, PRIMARY KEY (`id`) ); I keep my listings in a different table but you get the idea. This way I can have ads that list for 30,45,90 days if I want. Hope this helps. Regards, Ray |
(1) (of 1 pages)
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 10 |