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 trialDaniel Schroeder
13,859 PointsStar Wars: The Ultimate Soundtrack image not displaying when using database instead of original catalog array
NOTE I'm using MySQL on my own local machine, not the treehouse workspaces, so this may not apply to you if you are not using the downloaded program files.
Hi all, once I switched from the associative array that was hard-coded in data.php to the associative array returned by the PDO in connection.php, the Star Wars: The Ultimate Soundtrack image was broken and did not display.
The problem seems to be this line in database.sql: INSERT INTO Media
VALUES (29,'Star Wars: The Ultimate Soundtrack Collection','img/media/soundtrack_star_wars',54,'CD',2016,'Music');
The path 'img/media/soundtrack_star_wars' should have .jpg appended to it, like so: INSERT INTO Media
VALUES (29,'Star Wars: The Ultimate Soundtrack Collection','img/media/soundtrack_star_wars.jpg',54,'CD',2016,'Music');
If using a local MySQL db, perform the following query and this will be updated:
UPDATE Media SET img='img/media/soundtrack_star_wars.jpg' WHERE media_id=29;
Hope that helps!
1 Answer
jlampstack
23,932 PointsThe image in the media table is missing .jpg You can fix this with with a SQL update statement.
UPDATE media
SET img = 'img/media/soundtrack_star_wars.jpg'
WHERE media_id = 29;
Brian Pedigo
26,783 PointsBrian Pedigo
26,783 PointsThanks so much for this post! I am doing this course on my local machine too and noticed the error as well. I was pondering how to correct it when I came across this! Cheers to you for doing "all the work" ! XD