[insert_php]
echo “
“;
echo “
“;
echo “
“;
echo “
Date |
Table (Prep in UPPERcase) |
Door |
Hymn Books |
Music |
Powerpoint |
Offering“;
echo” |
“;
echo “
“;
$servername = “185.136.235.126”;
$username = “johnbaptist”;
$password = “baptist”;
$dbname = “baptist”;
// Make connection and then select the database
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}
$str_NextSundayDate = date(‘Y-m-d’, strtotime(‘now’));
$sql = “SELECT * FROM rotas WHERE sundaydate >= ‘$str_NextSundayDate’ order by sundaydate”;
$result = $conn->query($sql);
$gbdate = date(‘d-m-Y ‘, strtotime(‘next Sunday’));
$formatteddate = strftime(“%A %d %b %Y”, strtotime($gbdate));
$i = 1;
$oldMonth = “”;
$month = “”;
if($result->num_rows > 0){
while($row = $result->fetch_assoc()) {
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}
$formatteddate = strftime(“%d %b %Y”, strtotime($sundaydate));
$oldMonth = $month;
$month = substr($formatteddate, 4, 3);
if ($oldMonth != $month && ($oldMonth != “”))
{
echo “
|
“;
}
$i++;
$mod = $i % 2;
if ($mod == 1)
{
echo “
$formatteddate |
“;
echo “
$table1 |
“;
echo “
$door |
“;
echo “
$books |
“;
echo “
$music |
“;
echo “
$powerpoint |
“;
echo “
$offering |
“;
}
else
{
echo “
$formatteddate |
“;
echo “
$table1 |
“;
echo “
$door |
“;
echo “
$books |
“;
echo “
$music |
“;
echo “
$powerpoint |
“;
echo “
$offering |
“;
}
}
}
echo “
“;
[/insert_php]