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 trialJeffrey Cheong
5,653 Pointsthe 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.
1 Answer
Sergio Alen
26,726 PointsI 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
5,653 PointsThanks, 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.
Jeffrey Cheong
5,653 PointsJeffrey Cheong
5,653 PointsOn 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.