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 Integrating PHP with Databases Limiting Records in SQL Challenge

Yohan Park
Yohan Park
7,148 Points

Some tips for the genre dropdown challenge

This was frustrating for me as there’s not enough context to what she’s asking.

She is asking for a genre dropdown in the “suggest.php” page under format dropdown.

Genre should be organized by category (media), then alphabetically

Create a function that queries the DB in the functions.php

In the DB there’s a “Genres” table and a “Genre_Categories” table

They need to be joined by “genre_id”

Check to make sure the selection is not empty before executing the query

Loop the results to a nested array

In the suggest.php create an option selection that uses each array value as an option

Remember to keep in mind: connection.php, strtolower, if(!empty()), try/catch, prepare/bind/execute, html syntax for select and options.

Hope this helps

Leigh Maher
Leigh Maher
21,830 Points

Thanks Yohan. This was very helpful.