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

Aaron Uusitalo
Aaron Uusitalo
4,405 Points

concatenation with magic constants

I want to share something in case it is helpful to anyone.

I found that when instantiating a new sqlite object, I had to make sure to put a space before and after DIR or it would not be properly interpreted as a magic constant, and therefore would fail.

WORKED: $db = new PDO("sqlite:" . DIR . "/database.db"); FAILED: $db = new PDO("sqlite:".DIR. "/database.db");

I am working with a local Apache2 server in Ubuntu, and using Geany as my code editor.

Cheers.

Aaron Uusitalo
Aaron Uusitalo
4,405 Points

Note: underscores are not showing up in this post for some reason. Perhaps it's a matter of the output being escaped.