jonnyfortis Posted April 1, 2016 Share Posted April 1, 2016 i have a student register for attendance, down the side will be their names, across the top i will be showing each single day (example tuesday) from three month date range currently the code just echoes out all the Tuesdays as an array from the three month date range. i need to be able to use the individual date to add them to the database based on weather they student has attended. i know how to do this i just need to know how i can use the dates individually. function getDatesFromRange($start, $end) { $interval = new DateInterval('P1D'); $realEnd = new DateTime($end); $realEnd->add($interval); $period = new DatePeriod( new DateTime($start), $interval, $realEnd ); foreach($period as $date) { $array[] = $date->format('Y-m-d'); } return $array; } // Call the function $dates = getDatesFromRange('2016-04-01', '2016-07-01'); // Print the output print_r($dates); Quote Link to comment https://forums.phpfreaks.com/topic/301131-seperate-array-and-change-to-a-variable/ Share on other sites More sharing options...
requinix Posted April 1, 2016 Share Posted April 1, 2016 That's the code where you generate the dates. Apparently that's working? The dates themselves are right? So where's the code where you display the attendance table? Quote Link to comment https://forums.phpfreaks.com/topic/301131-seperate-array-and-change-to-a-variable/#findComment-1532714 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.