This is a bit from the query, a roster type database is looked at comparing current user and obtains data from the database. It always starts with today’s date and ends 12 days later using unix time.
<?php
$INQID = $member->userID();
$loc = $member->UserLocation();
$range_start = time();
$range_end = $range_start + 1036800;
$username = "******";
$password = "******";
$hostname = "******";
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
$selected = mysql_select_db("DATABASE",$dbhandle)
or die("Could not select DATABASE");
$result = mysql_query("SELECT username, date, state FROM ".$loc." WHERE username
=$INQID and date > $range_start and date < $range_end");
$result_array = array();
My question is how can I add a button to move the start date forward or back by 10368000 (twelve days unix time) which in turn will move the end date, showing the user the next 12 days. while preserving the start date when the user logs in? I would like to stick with unix time as the shifts cover 24 hours so it is easier for me to use.
<div id="Rbutt">
<a href="#" class="Rbuttons">Next</a>
</div>
<div id="Lbutt">
<a href="#" class="Rbuttons">Back</a>
</div>
I have two buttons left(-) and right(+) I would like to use however changing these is not a issue.
Try something like the following:
With the following HTML code:
Unfortunately I haven’t tested the above code (so I hope it’s right and actually works!) regardless, I think this should help point you in the right direction.
Obviously the input should be sanitized, but I’ll leave that to you.