Chose Language:
Author: Admin/Publisher |finished | checked

PHP and MySQL

We have discussed this before on the blog, but it’s time for it to have its own dedicated topic and the different ways to communicate with our database created with MySQL(DBMS).

We have 2 main options, which are PDO and MySQLi. These are called the main options because they are the ones that programmers are most familiar with. MySQLi is probably the one we learn in any course we take or its predecessor, the MySQL extension.

On the other hand, we have ADOdb, which is a PHP library that allows us to make changes to our database as well.

We can also mention some frameworks such as Laravel, Symphony, CodeIgniter, and others that have their own ways of interacting with our MySQL database.

PDO

PDO (PHP Data Objects) is an extension for PHP that provides a lightweight interface for accessing databases.

Note that PDO can be used to connect to other types of databases, for example MSSQL. Here are the drivers that PDO can use:

  • CUBRID (PDO)
  • MS SQL Server (PDO)
  • Firebird (PDO)
  • IBM (PDO)
  • Informix (PDO)
  • MySQL (PDO)
  • MS SQL Server (PDO)
  • Oracle (PDO)
  • ODBC and DB2 (PDO)
  • PostgreSQL (PDO)
  • SQLite (PDO)

The driver will be necessary when making our connection, as without it, we won’t be able to make any changes to our database.

MySQLi

The MySQLi (MySQL improved) extension allows us to access MySQL functionalities. In a way, it is an API for MySQL, as it defines the classes, methods, functions, and variables that an application needs to call to perform a specific task.

PDO can also be considered as another API, with these two being the main ones for communicating with MySQL. It is important to note that PDO has other options for communicating with other types of databases as well.

Here we could see more about the extension extensión MySQLi de PHP[ES]

ADOdb

As mentioned at the beginning of this post, ADOdb is a library that allows us to make changes to our database.

This is an abstraction layer for databases in PHP, which also allows us to select a driver to work with like PDO, although it has other characteristics different from the extensions we previously commented on.

From what I’ve seen of this topic, I know that portable SQL code can be written, so we wouldn’t have to worry about changing databases in the future if we anticipate this.

Finally, I will list some of the characteristics that it claims to have.

ADOdb contains components for querying and updating databases, as well as an Object Orientated Active Record library, schema management and performance monitoring. It also contains the following standalone extensions:

  • A Date/Time library to handle dates outside of the normal PHP limits.
  • A Session Management library that extends the normal PHP functionality to allow storing of session management data in a database, or in encrypted values
https://adodb.org/

There is no post about ADOdb on this website. If you are interested in this topic, I recommend visiting the adodb.org
Category: en-php
Something wrong? If you found an error or mistake in the content you can contact me on Twitter | @luisg2249_luis.
Last 4 post in same category