A lot of people posting here still seem to be using the mysql extension instead of mysqli or PDO. Here are some things you should know about doing this.
First, a quote from the PHP.net pages:
'There are three MySQL extensions, as described under the Choosing a MySQL API section. The old API should not be used, and one day it will be deprecated and eventually removed from PHP. It is a popular extension so this will be a slow process, but you are strongly encouraged to write all new code with either mysqli or PDO_MySQL.'
1. Mysql will eventually be removed from PHP
2. Mysql does not support prepared statements, a great way of saving time
3. Mysql does not support transactions at all
4. PDO has built-in SQL injection protection
5. I believe that parametrized queries (another security feature) are only supported in PDO
Personally, when writing quick code I prefer to use mysqli as I find it a little more intuitive. When I'm writing anything that I think has any potential.
I hope this proves useful for people, especially those just starting out writing code for working with MYSQL databases. Switch to mysqli or PDO now and you'll save yourself a lot of hassle later on!



