How to execute a MySQL query and fetch its result?

MySQL

Before I show you How to execute a MySQL query and fetch its result? We should know a little bit about MySQL. MySQL is an open-source relational database management system. It is very powerful database management system. MySQL has 3  main API options when considering connecting to a MySQL database server:

  • PHP’s MySQL Extension
  • PHP’s MySQLi Extension
  • PHP Data Objects (PDO)

MySQLi Object-oriented

MySQLi is an acronym for MySQL Improved.


MySQLi Procedural

PDO

PDO is an acronym for PHP Data Objects. PDO is a lean, consistent way to access databases.

Method 1: USE PDO query method

Method 2: Statements With Parameters

 

Leave a Reply