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

Sajid Latif
seal-mask
.a{fill-rule:evenodd;}techdegree
Sajid Latif
Full Stack JavaScript Techdegree Student 22,368 Points

My database works even if I spells it wrong. Who can help me? https://w.trhou.se/h6x7yjemq1

The strange part is that the database works even if I spells it wrong. So it wong catch it from at try catch block. Who can help me?

https://w.trhou.se/h6x7yjemq1

3 Answers

Karalyn Heath
Karalyn Heath
18,033 Points

Workspace seems to create a new database file automatically when we misspell the file name. I had to refresh the file view to see this. Using another syntax error will display the error block. Such as,

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

kabir k
PLUS
kabir k
Courses Plus Student 18,036 Points

Hi Sajid,

There's probably a setting that the teacher made on his computer that we haven't made that makes our exact same code behave differently.