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 trialTammy Burke
9,720 PointsGet NULL on single shirts
I was getting details in the var_dump on all the shirts and realized I was calling $products instead of $product. But when I made the correction, it gave me NULL on each shirt.
Is the problem elsewhere? I looked at the relevant lines on shirts.php and all looks as it should.
<?php
include("inc/products.php");
$product_id = $_GET["id"];
$product = $products[$product_id]; ?>
<pre>
<?php
echo $product_id . "\n";
var_dump($products);
?>
</pre>
1 Answer
Tomasz Budny
14,588 PointsIs the $product_id being properly echoed? Perhaps your query string has an error and your calling for an array id that does not exist.
Dean Gray
12,487 PointsDean Gray
12,487 PointsHave you put an product_id in your url??
Best test would be to set the variable product_id =102.