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 Build a Simple PHP Application Working With Functions Creating the Shirt Display Function

How to do all of this lesson if using PDO

I am frustrated that three methods are taught and different methods are used in each lesson. All of these lessons have functions based on mysqli, but later they teach that you aren't supposed to use mysqli; instead, you should be using PDO. However, all of these lessons are kind of obsolete now - it is good to understand old models, but now I am working on a new project and have no idea how to pull shirts from a database using PDO. So what do I do, use this lesson to create new files based on obsolete coding practices? Could Treehouse please update this video or make a version using PDO?????

1 Answer

Chris Shaw
Chris Shaw
26,676 Points

MySQLi or MySQL improved as it's known is the newer version and recommended version of the previous MySQL library that PHP came precompiled with, it to this day is a valid and highly used library within PHP and now is the standard DB layer for WordPress.

PDO is essentially a more robust and better version of the MySQL library within PHP and provides more advanced functionality and better out of the box protection against SQL injection and what not but it at this point in no way should be considered something you need to be using as MySQLi as I've said is perfectly valid to use.