| | |
I'm looking for a certain type of script (desc. within)
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Oct 2003
Posts: 85
Reputation:
Solved Threads: 0
Ok here is what I want to do:
I am going to have a "6 upcoming events" (baseball games) section on my website but I want to be able to enter all of the games on one day and have it show the 6 upcoming games on the website. The thing Is I want to able to enter them all and ignore the ones that have already happened (a date will be one field I am entering). Has anyone seen a script that could help me with this?
I am going to have a "6 upcoming events" (baseball games) section on my website but I want to be able to enter all of the games on one day and have it show the 6 upcoming games on the website. The thing Is I want to able to enter them all and ignore the ones that have already happened (a date will be one field I am entering). Has anyone seen a script that could help me with this?
The first thing that came to my mind was a javascript solution, but here is a php solution:
[PHP]
<?php
if (date('Y-m-d',strtotime('6/1/2005')) >= date('Y-m-d',time())) {
echo "<br />June 1: Game 1, blah, blah, blah";
}
if (date('Y-m-d',strtotime('6/15/2005')) >= date('Y-m-d',time())) {
echo "<br />June 15: Game 2, blah, blah, blah";
}
if (date('Y-m-d',strtotime('7/03/2005')) >= date('Y-m-d',time())) {
echo "<br />July 3: Game 3: blah, blah, blah";
}
?>
[/PHP]
You could also do a DHTML solution where you place each game within a DIV or SPAN. Give each DIV or SPAN an id equal to the game date. Then have a javascript fire onload that looks at all the DIVs or SPANs and if date is less than today, set (element).style.display="none";
PHP solution means you don't have to worry about any browser compatibility issues.
[PHP]
<?php
if (date('Y-m-d',strtotime('6/1/2005')) >= date('Y-m-d',time())) {
echo "<br />June 1: Game 1, blah, blah, blah";
}
if (date('Y-m-d',strtotime('6/15/2005')) >= date('Y-m-d',time())) {
echo "<br />June 15: Game 2, blah, blah, blah";
}
if (date('Y-m-d',strtotime('7/03/2005')) >= date('Y-m-d',time())) {
echo "<br />July 3: Game 3: blah, blah, blah";
}
?>
[/PHP]
You could also do a DHTML solution where you place each game within a DIV or SPAN. Give each DIV or SPAN an id equal to the game date. Then have a javascript fire onload that looks at all the DIVs or SPANs and if date is less than today, set (element).style.display="none";
PHP solution means you don't have to worry about any browser compatibility issues.
![]() |
Similar Threads
- backing up website/ftp site (IT Professionals' Lounge)
- Two domains on the same account (PHP)
- XHTML Validation ??? (JavaScript / DHTML / AJAX)
- javascript radio buttons and insanity (JavaScript / DHTML / AJAX)
- Help - Looking for a web hosting directory script. Any recommandations !? (PHP)
- mimedefang anti spam (*nix Software)
Other Threads in the PHP Forum
- Previous Thread: Help With Contact Us Form!
- Next Thread: Tabs causing errors
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube





