=$ashMonday && $now <=$pentecost) { //Festival season. Look up by what week of Festival time we're in. // Season IDs: // 1: Lent // 2: Holy Week // 3: Easter Season // 4: Advent (non-movable); // 5: Christmas (non-movable); // 6: Epiphany (non-movable); // 7: Pentecost // 8: Ascension if ($now>=$ascension && $now<=$ascension+$oneDay) { //Ok, so it's Ascension Day... $sql1 = "SELECT * FROM tbl_daily_lectionary WHERE season = '8' LIMIT 1"; $description = "Ascension Day"; } elseif ($now>=$pentecost && $now<=$pentecost+$oneDay) { //Ok, so it's Pentecost Day... $sql1 = "SELECT * FROM tbl_daily_lectionary WHERE season = '7' AND week='14' AND weekday='$day'"; $description = "Pentecost"; } elseif ($now>=$ashWednesday && $now<$easter) { //Lententide $difference=$now-($ashWednesday-$oneDay*3); //Gotta measure from Sunday before Ash Wednesday for the time to fit. $daysDifference=floor($difference/$oneDay); $week = floor($daysDifference/7); if ($week=='6') { //Holy Week if ($day=="Sunday") { $sql1 = "SELECT * FROM tbl_daily_lectionary WHERE season = '1' AND week='$week' AND weekday='$day'"; $description = "Palm Sunday"; } else { $sql1 = "SELECT * FROM tbl_daily_lectionary WHERE season = '2' AND week='$week' AND weekday='$day'"; if ($day=="Thursday") { $description = "Holy Thursday"; } elseif ($day=="Friday") { $description = "Good Friday"; } else { $description = $day." of Holy Week"; } } } else { $sql1 = "SELECT * FROM tbl_daily_lectionary WHERE season = '1' AND week='$week' AND weekday='$day'"; $description = $day." of the ".ordinal($week)." Week of Lent"; } } elseif ($now>=$easter && $now<$pentecost) { //Eastertide $difference=$now-$easter; $daysDifference=floor($difference/$oneDay); $week = floor($daysDifference/7)+7; //No clue why database has +7 on this stuff. $sql1 = "SELECT * FROM tbl_daily_lectionary WHERE season = '3' AND week='$week' AND weekday='$day'"; $description = $day." of the ".ordinal($week-6)." Week of Easter"; } elseif ($now>=$pentecost && $now<$holyTrinity) { //Week after and including Pentecost $sql1 = "SELECT * FROM tbl_daily_lectionary WHERE season = '7' AND weekday='$day'"; if ($day=="Sunday") { $description = "Pentecost Sunday"; } else { $description = $day." of the Week of Pentecost"; } } else { //Try today's date...? We should never get here. $today = date('n-j'); $exploded = explode("-", $today); $curmonth = $exploded[0]; $curday = $exploded[1]; //This will do the OT section. Query the DB, only pulling out today $sql1 = "SELECT * FROM tbl_daily_lectionary WHERE month = '$curmonth' AND day = '$curday'"; } } else { //Ordinary Time. Use some of Roy's original code here. //Figure out today's Month and Day $today = date('n-j'); $exploded = explode("-", $today); $curmonth = $exploded[0]; $curday = $exploded[1]; //This will do the OT section. Query the DB, only pulling out today $sql1 = "SELECT * FROM tbl_daily_lectionary WHERE month = '$curmonth' AND day = '$curday'"; } //Perform SQL query $res1 = mysqli_query($conn,$sql1); $cnt1 = my sqli_num_rows($res1); echo $cnt1; if($cnt1 > 0) { while($data1 = mysqli_fetch_array($res1)) { print_r($data1); $OT_reading = $data1['OT_reading']; $OT_alt_reading=$data1['OT_alt_reading']; $NT_reading=$data1['NT_reading']; $NT_alt_reading=$data1['NT_alt_reading']; $color=$data1['color_id']; } } //Once readings are set, display those puppies. echo '
Show Alternate Passage
'."\n"; echo ' '."\n"; } echo '