I have a table that has three fields. Event ID, Name, Date. My site pulls in records by event id but I would like the next button to go to the next record by date. How can this be accomplished? For example:
1 testing 11.1.2015
2 testing 11.3.2015
3 testing 11.2.2015
The link to the page pulls in event id like www.testing.php?eventid=1
But when I go to next I want it to go in date order not ID order. So it should go to event id 3. currently I have the code set up as below, how could I tweak it to use the date field?
$result5 = mysql_query("SELECT event_id FROM events group by event_id order by event_id DESC LIMIT 1") or die(mysql_error());
while ($row5 = mysql_fetch_array($result5))
{
$maxevent= $row5['event_id'];
<script>
$(document).on("pageinit",function(){
var pathname = $(location).attr('href');
var leva = $('#next').attr("href");
var prava = $('#prev').attr("href");
var preva = $('#ret').attr("href");
$("body").on("swiperight",function(){
<!--alert("You swiped right!");-->
location.href=prava;
});
$("body").on("swipeleft",function(){
<!--alert("You swiped left!");-->
location.href=leva;
});
if(leva === undefined) {
window.location.href="eventviewmusack.php?eventid=<?php echo $maxevent;?>";
}
});
</script>
只需更改查询用户ORDER BY日期ASC
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.