Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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