MySQLi

What is MySQLi? What does it do?

MySQLi is an extension for PHP, often referred to as MySQL improved. It was introduced in PHP 5.0, and will be in every version following (until something better comes along). It allows you to use all of the MySQL database (version 4.1.3 or newer) servers features. Some features of MySQLi are (from the PHP manual):

  • It’s object oriented interface, making it easier to use
  • Support for prepared statements, helping secure you code
  • Support for multiple statements, allowing you to run more than one query at a time

MySQLi not only has an object oriented interface but also a prodecural one. Making it even more widely usable.

Example of connection with the object oriented method:

<?php
$sql = new mysqli('localhost','username','password','database');
?>

Example of connection with the procedural method:

<?php
$link = mysqli_connect('localhost','username','password','database');
?>

And that is a nice, quick, simple introduction to the MySQLi extension for PHP.

By Mike on March 23, 2011 | MySQLi
Tags: , ,