Any one who has coded PHP scripts will have most definitely worked on connecting to mySQL databases using the PHP mysql library. Just by writing a few lines of code you could connect and select data from your desired database tables. Well like all good things come to an end so too this library. This library has been removed from PHP version 7 and deprecated in PHP 5.5.x so you must do away with mysql in all code you write from Dec 31 2018 onwards as there will no updates in this library. If you are wondering why this library is being removed now after all these years then read this post on php.net as well as this answer on Stack Over Flow.
Now don’t get scared. It’s not the end of the world. You have two options:
- Port your code to an MVC framework
1. MVC handles/upgrades your data access layer so you don’t need to worry about any future changes in your code.
2. Code is standardized and you enjoy all the benefits of using an MVC framework.
1. Development time will depend on the resources at hand and the learning curve associated in learning and then implementing that MVC framework
- Replace all references of mysql to mysqli
1. Barring a few functions and some change in syntax this will allow you to update your code very quickly. You may even be able to do this in one working day though you may need to check all your code.
2. Code remains the same as before (excluding the change from mysql to mysqli) so no learning curve invovled.
1. No major change in your code and you may need to repeat these steps provided there is any similar requirment in the future.