Hello Community,
I have recently been having a big of a look into connecting to a database using PDO but I'm not too sure what I should stick with, the normal way to connect to a MySql database or should I start using PDO. What would be better to use? and what does PDO have over the normal MySql code? like what can it do that the other can't.

Recommended Answers

All 2 Replies

The MySQL extension is deprecated, so will die off soon. Left is MySQLi versus PDO basically. There are some minor differences, but overall they do the same. The advantage of PDO is that it's easier to use a different database (Postgres for example) without having to rewrite your code. PDO is also OO code, whereas MySQLi can still be used procedurally. There are a lot of threads about these two in the forum, if you do a search you'll find plenty.

Ok, thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.