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!

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 Integrating PHP with Databases Databases and PHP Getting Started with PDO

Why is__DIR__ used in sqlite: but not in mysql:

I have a basic understanding that DIR is a magic constant that gets the directory name of the file, but I'm not sure why it's being used in sqlite and not in mysql?

What is the purpose for using DIR in sqlite, and why is it not in the teachers notes for those who are using mysql?

I fall into the category of those using mysql, so any help would be greatly appreciated.

Thanks in advance!

Thanks @sheacole , so does this mean we shouldn't use_DIR_ for mysql?

1 Answer

DIR denotes the directory where lies the script where it written. And, remember that SQLITE is simple a file. This constant ensures that you always get the absolute path to that file.

You can read more here. https://stackoverflow.com/questions/40159573/why-should-i-use-dir-when-creating-an-sqlite-database-with-pdo