Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP PHP Arrays and Control Structures PHP Loops Sorting Multidimensional Arrays

Phillip Legault
PLUS
Phillip Legault
Courses Plus Student 18,888 Points

Why due I have this list with complete task? Title Priority Due Date Complete Clean Out Fridge 2 07/30/2016 Yes

Everything seems correct but Title Priority Due Date Complete Clean Out Fridge 2 07/30/2016 Yes

shows up in my result

4 Answers

I think this is because the date now is a few weeks beyond what it was when this video was made. I'm not sure why Treehouse would use something so time sensitive. Try replacing "strtotime(+1)" with a date in July 2016, e.g. strtotime("25 July 2016"). This should take off that last value

Moderator Edited: Moved from Comment to Answer

Michael Moore
Michael Moore
7,121 Points

I had put in some ambiguous dates in the beginning, some being in 2017, and it now being 2018. It was listing dates in 2017 if they fell under that week range. Is there a way to prevent the 2017 dates from appearing? edit: It actually show any date in 2017, and I am guessing any date before it. So it is only checking for tasks that are ahead of the future. I guess I could make an OR statement

<?php
 if(strtotime($list[$value]['due']) > strtotime("+1 week") || strtotime($list[$value]['due']) < strtotime("-1 day")){
                unset($order[$key]);
            }
?>

right? Yeah. that worked.

Cliff Jackson
Cliff Jackson
2,887 Points

I also have the wrong list showing. I have three as opposed to just 2 and they are not the same. frankly the last two videos on this track are just a mess of hacking already written code and making it confusing to follow. Really not impressed with the later stages of the track and am starting to wonder are there better PHP courses elsewhere as these last few videos have wrecked it for me.

Alternatively to the answer Joel gave, you can edit the dates in your $list array in the list.php file to dates that are more relevant to when you are viewing this video. That way you are not actually changing the functionality of what the program was designed to do, only the values that it is working with.