PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi
this is my first post here.. seems a nice forum
I go straight to my problem: I'm trying to do a script that lets me display different texts in different days.. this is not very difficult with this kind of code:
$data = date("d.m.Y");
// files to include
if ($data=="26.05.2005") { include "alfa.html"; }
if ($data=="29.05.2005") { include "beta.html"; }
if ($data=="01.06.2005") { include "gamma.html"; }
if ($data=="05.06.2005") { include "omega.html"; }
The problem is that after the date specified the file is no more included.. how can I resolve this? For example, how can I display the same file (alfa.html) between 26 may and 29 may? Any ideas?
<?php
$data = date("d.m.Y");
// files to include
if ( $data >= "26.05.2005" || $data <= "29.5.2005" )
{
include "alfa.html";
}
// Do this for all the dates
?>
I think there will be a problem with "d.m.Y" format when comparing to each other.
What if you use "Ymd" format so as to make it, for example, "20050526" for "2005-50-26" then do what Sphen001 said.
Even if I change the first two dates (for example to april: 20050426 and 20050430) I always display the first file.. while it has to switch to the else condition.
Now I try also strtotime().. maybe I can get it to work (I hope so)