Hello. I'm having trouble figuring out how to do this. I have a Calendar function that generates a calendar based on the arguments I give it. I have an array called $days
that I store information such as $days["What days are linkable" = array("href page to link to, with arugments', "css-styling-for-that-day");
$days = array('schedule.php?month='.$thismonth.'&day='.$day. , 'linked-day');
I have that in a for loop that generates which days in the current month should be "clickable / scheduleable".
//generate linked days
$day = date('j',mktime(0,0,0,date("m"),date("d"),date("Y")));
for (;$day<=$lastdayofthismonth ; $day++){
$days[$day] = array('schedule.php?month='.$thismonth.'&day='.$day. , 'linked-day');
}
echo generate_calendar(date('Y', $time), $month, $days, 3, NULL, 0, $pn);
this works fine, it generates the calendar with what days I want to be formatted w/ hrefs and special css. When a user clicks on one of these linked days, it takes them to a form, and lets them schedule a time of the day, etc. and returns that information to the database.
So, what I want to do now is, take the days that have "scheduled appointments" on them, and store them into the array $days as well, with different values.
I have a SQL query that returns the correct "scheduled" days into the variable $appointments.
For example, of this month, the 23rd and the 28th are scheduled days. my sql query returns this:
$appointments[0] => 28
$appointments[1] => 23
which works. So, what I want to do now is, take the values of that array, and compare them to the $days array,
so that if $days[$day] is the same day as $appointments[$key] => $day
then,
$days[$scheduled_day] = array('schedule.php?viewmonth='.$month.'&viewday='.$day , 'scheduled-day');
// $schedule_day is just for reference. Doesn't exist.
bottom-line: How do I get $days to also include the days inside of $appointments with different values?
Any help is greatly appreciated! 🙂 I'm sure there's a simple way to do this, but I just can't figure it out! >.< lol