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 PHP & Databases with PDO PDO Queries & Results Query by ID

Igor Prymak
Igor Prymak
13,590 Points

"could not find driver" Error

Both in a Workspace and in PHPStorm IDE (PHP interpreter configured) I get the following error when trying to run index.php from this lesson: "could not find driver". Looks like I am not the only one with this problem on a forum, but it haven't been addressed yet. The code is correct, I didn't change it. Seems like the error is occurring while index.php is requiring database.php.

1 Answer

have you run it through the browser to see if it works there? i mean through wamp/mamp/vagrant etc whatever you use... maybe your IDE doesnt have the mysql driver..

Igor Prymak
Igor Prymak
13,590 Points

Thanks for your response. On xamp the site partially works, but I get the following error: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected Haven't changed anything in the code – just copied it over to htdocs. The string for connecting to DB is as follows: $db = new PDO('mysql:./database.db');