Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
PHP PDO: A How To (codular.com)
9 points by wrighty52 on Aug 12, 2013 | hide | past | favorite | 3 comments


It should mention the charset=utf8 DSN option. Omitting that when you need it (and you need it if your database is set to use utf8) can lead to a world of annoyance.


Once, I decided to do a project by using basic SQL libraries, let's say this includes PDO as it's almost a standard.

Then I thought, why would I use OOP (as PDO can only do that) if my project is not that big? I would not use PDO if I don't have a bigger project.

But. If I have a bigger project, why would I use basic stuff like PDO and not some ORM library?


First of all, why would the size of the project be relevant to using OOP? If you mean "free to write procedural hacks", the "new" statement is not going to make much difference to the complexity of the code.

On bigger projects, you may want to optimize certain queries beyond the limitations and overhead of the ORM abstraction, and go for straight SQL. (And since most ORM's use PDO, you can often steer away from complete duplication.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: