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

$_GET['id'] not working..

so at 4:28 it is not working as expected for me..

I tried to figure out what went wrong so i have added and else clause for if statement which is checking if $_GET['id'] is empty and did var_dump in it here is the result

Notice: Undefined index: id in /home/treehouse/workspace/films.php on line 8 NULL

this is the php code from my index.php file

<?php foreach($films as $film){ echo '<li><i class="lens"></i><a href="films.php?id='.$film["film_id"].'">'.$film["title"].'</li>';

}

?>

Chris Grazioli
Chris Grazioli
31,225 Points

Check your quotes... at first glance it looks like .$film["film_id"] .' ">' .$film["title"] . ' </li>' ; has something screwy going on there

1 Answer

Ok so I have solved this myself

closing a href tag was missing in that line from index.php

However I copied it straight from the video "Working with Results" from PHP & Databases from PDO which has an error which causes problems in next video