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 Getting Started With PDO Introductions

Jeffrey Cheong
Jeffrey Cheong
5,653 Points

the preview does not register the error for dataaaabase.db still reads as an object

no matter what I type in PDO object brackets for the database file name it still returns as 'object(PDO)#1 (0) { }'. Im not sure if I made a mistake in sqlite however it did display the following after inserting the sqlite command to the console:

/home/treehouse/workspace/.database.db

the PHP code for the PDO object is:

$db = new PDO('sqlite:./dataaaaaabase.db'); //3

which still seems to output the correct var_dump. Can't figure out the problem.

Jeffrey Cheong
Jeffrey Cheong
5,653 Points

On top of not reading it as an error, When i refresh the workspace it just creates a new database with the name of the database that follows the 'sqlite:.' snippet of code in the PDO object.

1 Answer

I think it's a problem with workspace, if you read the teacher's notes, it says to write the following instead:

$db = new PDO('sqlite:/database.db');

basically just removing the dot before the forward slash to trigger error

Jeffrey Cheong
Jeffrey Cheong
5,653 Points

Thanks, that seems to work in catching the error and it doesn't create random db files anymore, however now it only registers errors. Nothing else changed other than the period after the colon.