Jump to content

PDO vs. mysql_*


neogranas

Recommended Posts

I'm hoping to get direction on this subject. I've seen some articles and how-to's on PDO recently and all I've ever seen on them is seemingly just an alternative to use mysql_(whatever). Can someone explain to me what the difference between them is and why one would be better than the other, or if it's just a situation of use PDO when doing one sort of application and mysql_(whatever) for another?

 

I did search the forums and didn't find anything that really explained it to me, but maybe I didn't search right, if I missed where this has already been brought up, I apologize.

Link to comment
Share on other sites

1. With PDO you don't need to write separate code when you change database. mysql_connect will only work for MySQL and not MS SQL Server or Oracle. For that you will need to use different methods. PDO solve this problem.

 

2. With PDO when you use parameters then all user input is automatically sanitized. You don't need to sanitize it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.