can anyone give me some help on php? i am trying to make a calendar to use with wwwthreads to show birthdays for the users. i am able to show one birthday for each month but not able to show multiple birthdays for each month. can anyone take a peep at my script and see whats up? thanks in advance!
// get all the info if (!$HTTP_POST_VARS) { $theDate = getdate(); $mon = $theDate["mon"]; // numeric month (1-12) $month = $theDate["month"]; // display month january, feb.. $year = $theDate["year"]; // 4 digit year (y2k compliant) } if ($action = "findDate") { $theDate = getdate(mktime(0,0,0,$mon,1,$year)); $month = $theDate["month"]; }
// get what weekday the first is on $tempDate = getdate(mktime(0,0,0,$mon,1,$year)); $firstwday= $tempDate["wday"];
// get the last day of the month $cont = true; $tday = 27; while (($tday <= 32) && ($cont)) { $tdate = getdate(mktime(0,0,0,$mon,$tday,$year)); if ($tdate["mon"] != $mon) { $lastday = $tday - 1; $cont = false; } $tday++; }
yeah it prints out everything and then it displays every birthday in one day. example http://extremeforums.org/calendar2.php i don't know if or how it can be done, but it needs to do a while if statement while in another while statement.but then it needs to do it again for if there are multiple birthdays. thanks....
I think there are 2 ways you could solve this problem. You could either execute the query to see if there are any birthdays on that particular day within the loop where you are printing out the days. That means a query for each day.
Or, you could grab all birthdays within the month and stuff them into an array of some sort that keys off of the day and then when printing out each day you could check the array.
Sorry I can't be of much more help. Kinda tough to figure out what to do without having it to work on. Though it does look like a pretty cool addition.
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.