我正在使用一个数据库编写一本祈祷书,其中包含教会日历(数字教学)每天的读数。 页面代码是相当简单的PHP,它使用当前日期来确定教会日历的哪一天。 这是我得到日期的地方:
$dateinput = date('Y-m-d'); $dateTime = strtotime(date('Y-m-d')); $dateDt = date('Y-m-d', $dateTime); $year = date('Y',$dateTime)."<br>";然后我找到了,基于圣诞节,复活节等,它是教会日历的哪个季节,那个季节的哪一周,以及一周的哪一天。
然后我选择与该季节,周和日相匹配的行:
$result = mysqli_query($link,"SELECT * FROM prayer WHERE Year='$lectionaryYear' AND SuperSeason='$superSeason' AND Week='$week' AND Day='$dayOfWeek'");它运作良好,但我希望能够点击箭头来查看昨天的读数或明天的读数。 这可能吗? 我知道PHP是服务器端,我想象的是客户端,所以也许这不是一个选项。
最后的结果就在这里。
I am programming a prayer book using a DB that contains readings for each day of the church calendar (a digital lectionary). The page code is fairly simple PHP that uses the current date to determine which day of the church calendar it is. Here is where I get the date:
$dateinput = date('Y-m-d'); $dateTime = strtotime(date('Y-m-d')); $dateDt = date('Y-m-d', $dateTime); $year = date('Y',$dateTime)."<br>";Then I find, based on Christmas, Easter, etc. what season of the church calendar it is, what week of that season, and what day of the week.
And then I select the row that matches that season, week, and day:
$result = mysqli_query($link,"SELECT * FROM prayer WHERE Year='$lectionaryYear' AND SuperSeason='$superSeason' AND Week='$week' AND Day='$dayOfWeek'");It works well, but I would like to be able to click an arrow to look at yesterday's readings or tomorrows readings. Is this possible? I know PHP is server side, and what I'm imagining would be client-side, so maybe this just isn't an option.
The final result is here.
最满意答案
您可以使用$ _GET变量并通过前后按钮将日期传递给URL。
你的href看起来像这样
<a href="http://www.example.com/?date=<?php echo date('Y-m-d', strtotime('-1 DAY')); ?>">Back</a>然后使用日期查询。
$_GET['date']You can use the $_GET variable and pass the dates to the url via your back and forth buttons.
Your href would look like this
<a href="http://www.example.com/?date=<?php echo date('Y-m-d', strtotime('-1 DAY')); ?>">Back</a>And then use the date for your query.
$_GET['date']更多推荐
发布评论