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
https://forums.phpfreaks.com/topic/228351-pdo-vs-mysql_/
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
https://forums.phpfreaks.com/topic/228351-pdo-vs-mysql_/#findComment-1177522
Share on other sites

Is there any advantages to using PDO such as execution time or security? The reason I'm asking is because I've just started building an application and I would like to know if I could just continue with what I know using mysql_connect or if I should switch. Any advice?

Link to comment
https://forums.phpfreaks.com/topic/228351-pdo-vs-mysql_/#findComment-1178198
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.