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
Lucas Santos19,315 Points
Can I still learn from mySQL course even though he writes his SQL differently?
In the PHP with mySQL course Randy writes his mySQL code in a PDO format. I write mySQL with MySQLi Object-Oriented format. Is it still possible to learn form this course even tho he writes his mySQL different than mine. Also I use the MySQLi Object-Oriented format because I read that currently it's the best way to write your mySQL code.
Peter Smith12,347 Points
I'm a novice at MySQL and PHP but the thing that matters most to me is preventing MySQL injection exploits. Based on that, influenced by my reading here I think PDO is better than MySQLi. I'm specifically referring the line in the linked document, which states in its Language specific recommendations section... "PHP – use PDO with strongly typed parameterized queries (using bindParam())"
I've read quite a few convincing arguments between the two, but personally I always go for PDO because it's better - and at no extra cost.
This article gives quite a nice, non-bias comparison between the two. PDO just has a few more things going for it - probably features you wouldn't really use that often - but because the differences in overhead is minimal, I would suggest converting to PDO.
Regardless - if you can connect to a database using a safe and protected method, that's all good!