This is more complicated that I thought. I don’t know if there is an easier way so if someone has a easier way please post because I sit with this one quite often.
I don’t have much time but this will put you on the right track. This firs bit is just to give you the basics on how it’s going to work.
$date_year_today = date(‘y’);
$date_month_today = date(‘m’);
$date_day_today = date(‘d’);
$date_today = “$date_year-$date_month$date_day“;
//Say today is the 19 this wil give you 2004-11-19.
$date_day_1 = “$date_day_today”;
$date day 1 += “1”;
//This will give you 20.
$date day_2 = “$date day 1”:
$date day 2 += “1”;
//This will give you 21.
$date day 3 = “$date day 2”:
$date day 3 += “1”;
//This will give you 22.
$date day 4 = “$date day 3”:
$date day 4 += “1”;
//This will give you 23.
$date day 5 = “$date day 4”:
$date day 5 += “1”;
//This will give you 24 five days later.
$date_allow_1 = “$date_year_today-$date_month_today-$date_day_1”;
//this will give you 2004-11-20.
$date_allow_2 = “$date_year_today-$date_month_today-$date_day_2”;
//this will give you 2004-11-21.
$date_allow_3 = “$date_year_today-$date_month_today-$date_day_3”;
//this will give you 2004-11-22.
$date_allow_4 = “$date_year_today-$date_month_today-$date_day_4”;
//this will give you 2004-11-23.
$date_allow_5 = “$date_year_today-$date_month_today-$date_day_5”;
//this will give you 2004-11-24.
// Now in your db table you must have date_entered wich will be $date_today, //date_allow_1, date_allow_2, //date_allow_3, date_allow_4 and date_allow_5.
//On your output page you will extract the values of all the dates from your db. And use this code.
$date_1 = date(‘Y-m-d’)
$link = mysql_connect("localhost","username","password");
mysql_select_db("db_name",$link);
$sql = "select * from table ";
$result = mysql_query($sql);
While ($myrow=mysql_fetch_assoc($result)) {
$date_allow_1 = $myrow[‘date_allow_1’];
$date_allow_2 = $myrow[‘date_allow_2’];
$date_allow_3 = $myrow[‘date_allow_3’];
$date_allow_4 = $myrow[‘date_allow_4’];
$date_allow_5 = $myrow[‘date_allow_5’];
// you can also use extract($myrow) I’m just doing it this way so you can see what I’m //doing.
If (($date_1 = = “$date_allow_1”) || ( $date_1 = = “$date_allow_2) || ( $date_1 = = “$date_allow_3) || ( $date_1 = = “$date_allow_4) || ( $date_1 = = “$date_allow_5)) {
Echo “
//What ever it is.
“;
}
}
// Your main problem is going to come in when your day will be like the 30th, then youl have to ad +1 to the month too. And do something like. Say the date is the 31st.
$date_day_1 += “1”;
//$date_day_1 will now be 32
//You will have to do this for each month. Because not all the months have 31 day’s
If ($date_month_today = = “1”) {
If ($date_day_1 > “31”) {
$date_day_1 = “1”;
$date_mont_today += “1”;
If ($date_moth_today > “12”) {
$date_month_today = “1”;
$date_year_today += “1”;
}
}
}
If ($date_month_today = = “2”) {
If ($date_day_1 > “28”) {
$date_day_1 = “1”;
$date_mont_today += “1”;
If ($date_moth_today > “12”) {
$date_month_today = “1”;
$date_year_today += “1”;
}
}
}
Etc. etc. etc.
Yoou will also have to keep in account for the year 2008 where February has 29 days and not 28.
I know this is a hand full, I hope it puts you on the right track.