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 CRUD Operations with PHP Creating Records Reading Project Data

Caron Rumsey
Caron Rumsey
2,683 Points

CRUD Operations with PHP. Reading Project cannot connect when add php to project_list.php file.

I followed the video, and have added the below PHP script in the project_list.php file but I get error when I view it in browser. I have checked and checked the script for comparison but cannot see where I'm going wrong. It all works fine until I enter this code.

The code I added to the project_list.php file is <?php foreach (get_project_list() as $item) { echo "<li>" . $ item['title'] ."</li>;
} ?>

Thank you.

1 Answer

Niki Molnar
Niki Molnar
25,698 Points

Hi Caron

If you copied and pasted the code you entered, then it looks like you're missing the final " after the </li>:

<?php foreach (get_project_list() as $item) { echo "<li>" . $ item['title'] ."</li>;
} ?>

should be

<?php foreach (get_project_list() as $item) { echo "<li>" . $ item['title'] ."</li>";
} ?>

Hope that helps!

Niki

Caron Rumsey
Caron Rumsey
2,683 Points

Thank you so much Niki.