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 trialOkafor Matthew
Courses Plus Student 2,633 Pointsdisplaying all items
Please help, am currently doing the php tutorial and on the stage of building basic web site then i ran into some error which get me stucked. here is the code
<?php
include ("include/data.php");
$pageTitle = "Full Catalog";
$section = null;
if(isset($_GET['cat'])){
if($_GET['cat']=="books"){
$pageTitle = "Books";
$section = "books";
}else if($_GET['cat']=="movies"){
$pageTitle = "Movies";
$section = "movies";
}else if($_GET['cat']=="music"){
$pageTitle = "Music";
$section = "music";
}
}
include("include/header.php");?>
<div class="section catalog page">
<div class="wrapper">
<h1><?php echo $pageTitle;?></h1>
<ul class="items">
<?php foreach($catalog as $item){
echo "<li><a href='#'><img src='"
. $item["img"] ."' alt='"
. $item["title"] . "' />"
. "<p>View Details</p>"
. "</a></li>";
}
?>
</ul>
</div>
</div>
<?php include("include/footer.php");?>
i preview the it on the browser but an error message of illegal string offset ['img'] and ['title'] was displayed. can someone tell me where i have gone wrong please
Mike Wagner
23,559 PointsMike Wagner
23,559 PointsIt would be easier to sift through your code if it was formatted properly within the post. It would be even better if you had this in Workspaces and forked it to share here :)