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 Build a Simple PHP Application Listing Inventory Items Associative Arrays

jarrod Reeves
jarrod Reeves
6,357 Points

Why am I getting an error?

I got up to task 5 of the challenge and said task 3 is no longer passing. So I went back to task 3 and it says this:

Bummer! It looks like the title of the second movie is in the <h1>, but something else isn't quite right. Double-check the parentheses and the year. Preview Recheck work
<h1><?php echo $movie ["title"]; ?> (<?php echo $movie ["year"]; ?> )</h1>

What have I done wrong?

2 Answers

Andrew Shook
Andrew Shook
31,709 Points

Jarrod, the code challenge is giving you an error because you put a space between the end of the year and the closing parentheses. You have this:

<h1><?php echo $movie ["title"]; ?> (<?php echo $movie ["year"]; ?> )</h1>

and it needs to be this:

<h1><?php echo $movie ["title"]; ?> (<?php echo $movie ["year"]; ?>)</h1>

It does that a lot, task 3 is fine, it's task 5 where your problem is. But I would need to see your code in order to help you.