Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.