MySQL vs MySQLi vs PDO

5 minutes
Share the link to this page
Copied
  Completed
The MySQLi is an extension to work with MySQL version 4.1.13 or newer. MySQLi is introduced with PHP Version 5.0 and is a replacement for the mysql functions, with object-oriented and procedural versions. ... PDO (PHP Data Objects) is a general database abstraction layer with support for MySQL among many other databases.

Transcript

Hello, in this video, we are going to discuss the difference between my SQL, my SQL I and PD. So my SQL was one of the original systems for you know, handling databases, you know, storing the data into databases for PHP, and it was introduced in PHP version two, we are on PHP version seven point something depending when you watch the video, and misc UI is done for improved. And my SQL I was introduced in version 5.0 PDO. It stands for PHP data object was introduced in 5.1. So not long after five. So in terms of the development status, my SQL only has maintenance in version five.

It's been removed in version seven, my SQL I am PDO is still in development status. So it's still you know, continually been added and developed For in the latest version, so that's not a problem in terms of the life cycle. My SQL was actually deprecated in version five still there, but deprecated, meaning that it's basically going to be removed soon and recommend that you start using a different system and it was removed in version seven. I am PDO is still active in in general. And my SQL is not recommended for new projects. I am PDO is recommended for new projects it my SQL does not have an object oriented programming interface that you can use objects to, you know, handle and connect to databases and do manipulations on your database.

But with the other two you can you can do a procedural interface with the original mice and mice UI, but you can't do that with PDO. So if you really want to procedural in our programming the procedural interface, then you will have to use one of the first two hoping you're getting the picture, do not use my SQL, because it's not supporting our on and get on to the other reasons why you shouldn't support it as well. Okay, so the API in terms of supporting non blocking asynchronous queries using my SQL, nd only my SQL, so I supports that. In terms of persistent connections, all of it supports it in terms of character sets, they will support it, that's fine. In terms of supporting server side prepared prepared statements, this is where he gets pretty cool. Only, I mean, my SQL, I MP do both support it so prepared statements authentic statements that have been essentially already created.

And those are the statements that you'll be using, whether it's an update statement to create statement for example, and prepare statements are generally more secure. But in terms of the client side prepared statement, the only one that's posted is PDO. So what that means is if you're using my SQL or even my SQL I, which is still heavily used, you will basically have to do some basic checking to prevent your website from being hacked, whereas PDO none of them are 100% foolproof, but we'll do some basic checking to prevent some sort of code injection using prepared statements. And in terms of stored procedures, like UI and PDO. Both supported in terms are multiple statements, my SQL does not support a, it supports it, and PDO supports most of it, terms of transactions, I PDO supports a and you can control any transaction with all of them.

And in terms of supporting my SQL 5.1 or newer functionality. My SQL doesn't support it because it's been removed and deprecated In my SQL, I does PDF ports, most of it. So the main one that I would highly recommend using is PDO. Just because of the prepared statement, it is the better and more recommended way of interacting with databases. And because they have, you know, an object oriented interface as great as well, to prepare statements, make your website just a lot more secure off the bat. So you don't really no need to know too much about security.

The more you know, the more you implement the Barry will be in general, but without knowing it, if you just do a good PDO statement, you will actually do some basic, you know, essentially stripping off characters and preventing, you know, somebody injecting code into the database, which when retrieved could potentially you know, wipe the database, do some unforeseen stuff on the client side of the website, or in my SQL, I can sort of support that. But you will asked him specifically make sure You know, set it that way. So, I will be doing PDO for the rest of the videos, but that's the difference between them any questions you know if you want to know a little bit more, feel free to pop me a message. And as usual, I look forward to seeing you in the next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.