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 Querying the Database with PHP Querying the Database

Hi, I tried to run the project in my own environment but I can't past the second try-catch :(

Hi, I tried to run the project in my VSC studio but I can't past the second try-catch :( I downloaded the SQL file, set it in myAdmin, I see the tables with all files in, I'm conectet to the database but can't pass the second try-catch. <?php try { $db = new PDO("mysql:host=localhost;dbname=test;port=3306", "root", ""); $db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); } catch (Exception $e){ echo "Unable to connect"; echo $e->getMessage(); exit; } echo "Connected to the database"; try { $results = $db->query("SELECT title, category FROM Media"); echo "Retrieved Results"; } catch (Exception $e) { echo "Unable to retrieved results"; exit; } My result is: Connected to the databaseUnable to retrieved results