$servername = "localhost";
$username = "thrabnki_user";
$password = "?,RAu&m)CGvg";
$dbname = "thrabnki_devoapp";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if ($_GET["date"]) {
$date = htmlspecialchars($_GET["date"]);
} else {
$date = date("Y-m-d");
}
$conn->query("SET SESSION character_set_results = 'UTF8'");
if (strtotime($date) > strtotime("-15 day") && strtotime($date) <= strtotime(date("Y-m-d"))) {
$sql = "SELECT * FROM `devotions` WHERE `date` = '" . $date ."'";
}
// if (strtotime($date) > strtotime("-15 day")) {
// if (strtotime($date) <= strtotime(date("Y-m-d"))) {
// $sql = "SELECT * FROM `devotions` WHERE `date` = '" . $date ."'";
// }
// }
$result = $conn->query($sql);
// if ($result->num_rows > 0) {
// // output data of each row
// while($row = $result->fetch_assoc()) {
// echo $row["title"]. "\n" . $row["scripture"]. "\n" . $row["body"]. "
";
// }
// } else {
// echo "0 results";
// }
if ($result->num_rows > 0) {
$rows = $result->fetch_assoc();
} else {
echo "0 results";
}
$conn->close();
$time = strtotime($date);
?>
3ABN Kids Network | Daily Devotion for Kids
January 1
$body = preg_replace('#\r\n#', '
', $rows['body']);
echo $body
?>
if (strtotime($date) > strtotime("-15 day")) {
echo 'Previous';
}
?>
if (strtotime($date) < strtotime(date("Y-m-d"))) {
echo 'Next';
}
?>