Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 13th, 2004, 10:45 PM
Authorized User
 
Join Date: Jan 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default Scheduled Information?

Is there a way with PHP that you can put different information on the webpage on certain days? Example: have info#1 appear on days Jan 1-15 and info#2 appear on days Jan 15-31 and so on....If PHP can't do this, is there another way I could do this? Thanks for the help!

 
Old September 13th, 2004, 11:48 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Yes, it can. You have to schedule a script to run, whereas the script would update a database or flatfile. This is done on Unix by making a cronjob. On Windows it's a scheduled task. Don't remember the specifics off hand, but just google on those terms and you should come up with the information that you need.

HTH!


Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
 
Old September 25th, 2004, 11:23 AM
Authorized User
 
Join Date: Aug 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to dkittell Send a message via AIM to dkittell Send a message via Yahoo to dkittell
Default

I would agree with Richard on this, CronJobs is the real way to go, but another way that it could be done is if you do a select statement that pulls from a DB or flatfile to display the info. The CronJobs are a better way to do this as I believe it would be better for the server processing.

---
David Kittell
 
Old September 25th, 2004, 11:40 AM
Authorized User
 
Join Date: Jan 2004
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I really appreciate your help, but I have to say :( that I don't know the first thing about php!!! Is there any site that could show me how to do this...or better yet...some pre-written code? Thanks for all your help!!!

 
Old September 26th, 2004, 08:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Am I missing something, guys? Surely you could just run:

if(date("d")<15){
//Do one thing: e.g. require _once(beginning_of_month.php);
}else{
//Do t'other thing
}

Stacy, date("d") simply returns the numeric day of the month value for the present day the script runs on. date() is actually an incredibly flexible and useful function: more about it here: http://uk2.php.net/manual/en/function.date.php

HTH
Dan
 
Old September 26th, 2004, 10:42 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Oh, yeah, looks like I misinterpretted the question. Sorry about that.

Regards,
Rich

--
[http://www.smilingsouls.net]
[http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail





Similar Threads
Thread Thread Starter Forum Replies Last Post
Scheduled executions GuidoDB SQL Server 2000 3 January 21st, 2007 07:48 PM
Scheduled task langer123 Classic ASP Basics 0 March 16th, 2005 11:14 AM
scheduled access rajanikrishna Classic ASP Databases 1 July 9th, 2004 04:07 AM
[c#]scheduled task maddonuts General .NET 1 July 7th, 2004 11:53 AM
Scheduled Task Ben Access VBA 1 February 24th, 2004 02:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.