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

Development Tools

"Getting Started with PDO" troubles

I am having a problem connecting to the database. I am thinking it might be because I downloaded MAMP with MySQL Workbench for the "Build a Simple PHP Application" module and then also downloaded MySQL Workbench standalone for the "Database Foundations". Should I uninstall one of them or both and then start fresh? Or could it be that I have just pointed the code to the wrong place?

<?php

$db = new PDO("mysql:host=localhost;dbname=shirts4mike;port=3306", "root", "root"); var_dump($db);

Thank you so much in advance for any help!

Shaun Dixon
Shaun Dixon
10,944 Points

As long as you only have one of them running at a time it should not cause any issues.

(I have just started the database lessons and that is one of the things that was mentioned). Not sure on how you connect the database correctly as I have not got that far through the lessons yet :).