I am working on a scheduling system (yes I have seen the others and I preferr to just make one to suite me better) and I have a question. The script retrieves info from a MySql DB based on variable '$apptdate' (www.mysite.com/dailyview.php?apptdate=2003-05-15) As you can see the apptdate is a a text version of a timestamp (Y-m-d). Enought of that, here is where I need help. How do I link to another day. For example I need to get the script to add a day "...dailyview.php?apptdate=2003-05-15" to ..."dailyview.php?apptdate=2003-05-16". Does that make any sense?
Hi,
I hope I understood what you mean 🙂
You can create such a date string with
$year=2003; $month=05; $day=16; $appdate = date("Y-m-d",mktime(0,0,0,$month,$day,$year));
This would be equal to $appdate = "2003-05-16" in the above example;
That is not quite what I think I need, I may not be using it right though. See the page's variable appt_date will vary. So some instances it would be 2003-05-16 and others it woulc be 2003-06-04 or something, it just depends on what day I need to look at. So how do I get the variable ($apptdate). Is there a way to let the script know that it is a date and break it up into a date string? Does that give a clearer picture of what I am trying to do?
Why do people have such a hard time explaining what their problem is? I'll give it a shot...
$cDate = $_GET['apptdate']; list($dYear,$dMonth,$dDay) = explode("-", $cDate); $nDate = date("Y-m-d", mktime(0,0,0,$dMonth,$dDay+1,$dYear)); // cDate is the current date // nDate is the next date
Because EVERYONE has to learn somewhere and it is hard to explain what one is not sure of. If I had a better grasp I probably could find the answer on my own.
And deep breath thank you for your help, it worked perfectly. 🆒
Wasn't trying to give you a hard time, i'm glad it helped and good luck. You should mark this thread as resolved 😉