Head Twister: Need Help Please

From: Date: Sun, 20 Apr 2003 00:23:31 +0000
Subject: Head Twister: Need Help Please
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144509@lists.php.net to get a copy of this message
Hello, I am trying to build a PHP script that can tell the members of our fire department what crew is working on a given night, after selecting a date. The shifts are awkward and I originally builta very primitive way to display who's on duty (below). But I know this is not the right way to do it, and also won't allow for a member to select a given future date and find out. Each crew has a bye week so, it's like a given week: 1(bye) 2,3,4,5,6,7, then 1,2(bye), 3,4,5,6,7, then 1,2,3(bye),4,5,6,7 and so on... I think I'm cross eyed after trying to write a script that would determine the day of the year (date("z") and then do the math to get the number. If you feel led to help out the fire department pleeeze do :-)... BTW, you can see the old script below working at the top of www.svfd.org Thanks, Jeff <?php $crewMar = array(1=>"3","5","6","7","1","2","3","4","6","7","1","2","3","4","5","7","1","2","3","4","5","6","1","2","3","4","5","6","7","2","3"); $crewApr = array(1=>"4","5","6","7","1","3","4","5","6","7","1","2","4","5","6","7","1","2","3","5","6","7","1","2","3","4","6","7","1","2"); $crewMay = array(1=>"3","4","5","7","1","2","3","4","5","6","1","2","3","4","5","6","7","2","3","4","5","6","7","1","3","4","5","6","7","1","2"); $day = date("j"); $month = date("F"); print (date ("l F dS, Y")); print ("&nbsp;&nbsp;&nbsp;&nbsp;"); if ($month == "March") { print ("Crew $crewMar[$day] is on duty");} if ($month == "April") { print ("Crew $crewApr[$day] is on duty");} ?>

« previous php.general (#144509) next »