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 Using PHP with MySQL Limiting Records in SQL Queries Using COUNT

jo vo
PLUS
jo vo
Courses Plus Student 4,830 Points

Echo $error-message

Wouldnt it be smart to write an error message variable inside database.php?

It gets really old to have to write: "could not retrieve data from the database" everytime.

For example: $error-message: "Could not retrieve the data from the database";

and then echo $error-message in all the different php files

2 Answers

Yes, it's smart. :)

Jamie Goodwin
Jamie Goodwin
14,251 Points

Yeah totally had that idea as well. Even considered it as a function just to practice the process. Stay curious Jo.