PHP Programming
Group for all things PHP, Coding Help, Problems and Solutions
101 Members
Join this group to post and comment.
Shruthi Pillai
Shruthi Pillai
Information Technology
17 Jan 2019

Modernizing database handling in php

The truth is that the PHP MySQL extension is depreciated, you should avoid it at all costs.Currently two main extensions in PHP for dealing with databases. One is MySQLi (MySQL improved) and the other is PDO (PHP Data Objects). They both support almost all the database operations, such as insert, delete, update, database transaction, real escape string and so on.

I recommend using PDO to build your applications due to the following two reasons:

  •  It enables developers to write portable code. 
  • It encourages object-oriented programming.

PDO supports more than ten databases including MS SQL, Oracle, PostgreSQL, SQLite and so on. This is really powerful, because we can write our code once and let it run on different types of database engines.

2mos ago

Unless the developer is super comfortable with handling databases and writing optimised queries, I'd recommend using a layer of abstraction to handle that. I'm addicted to Laravel's ELOQUENT; which builds queries based on conditions specified in the code.