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 Managing Errors

error handling question

So i created a new class like you showed it: //$db = new PDO('sqlite:./database.db');

And if I change the 'database.db' to 'databaseeeee.db', it will not throw an error, but instead a new file called databaseeeee.db will be created inside the same directory.

Can I get help pls :(

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi, Damjan Tropcic! This used to cause an error and still could potentially if the computer you are coding on has older SQLite drivers. But SQLite drivers have been updated such that if it cannot find a database file with that name, it'll create one. However, it's still a good thing to know in case you're ever dealing with a situation where you are dealing with outdated drivers or some other issue that is preventing the database from opening that initial connection.

Hope this helps! :sparkles:

edited for additional information

Check out the Teacher's notes for this video to see other ways to force the error message :smiley:

Thx a lot, it helped! :)