
- MySQLi Tutorial
- MySQLi - Home
- MySQLi - Introduction
- MySQLi - PHP Syntax
- MySQLi - Connection
- MySQLi - Create Database
- MySQLi - Drop Database
- MySQLi - Select Database
- MySQLi - Create Tables
- MySQLi - Drop Tables
- MySQLi - Insert Query
- MySQLi - Select Query
- MySQLi - Where Clause
- MySQLi - Update Query
- MySQLi - Delete Query
- MySQLi - Like Clause
- MySQLi - Sorting Results
- MySQLi - Using Joins
- MySQLi - Handling NULL Values
- Obtaining & Using MySQLi Metadata
- MySQL
- MySQL - Installation
- MySQL - Administration
- MySQL - Data Types
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQLi Useful Resources
- MySQLi - Useful Functions
- MySQLi - Quick Guide
- MySQLi - Useful Resources
- MySQLi - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
MySQLi - Introduction
MySQLi is an extension to MySQL API available in PHP and is introduced from PHP 5.0 onwards. It is also known as MySQL improved extension. Motivation behind MySQLi was to take advantage of new features available in MySQL 4.1.3 onwards. It provides numerous benefits over MySQL extension.
MySQL provides an object oriented interface. It provides both object oriented and procedural approach to handle database operations.
Object Oriented Interface
<?php $mysqli = mysqli_connect("localhost", "user", "password", "database-name"); $result = mysqli_query($mysqli, "SELECT 'Welcome to MySQLi' AS _msg FROM DUAL"); $row = mysqli_fetch_assoc($result); echo $row['_msg']; ?>
Procedural Approach
<?php $mysqli = new mysqli("localhost", "user", "password", "database-name"); $result = $mysqli→query("SELECT 'Welcome to MySQLi' AS _msg FROM DUAL"); $row = $result→fetch_assoc(); echo $row['_msg']; ?>
MySQLi supports prepared statments.
MySQLi supports multiple statments.
MySQLi supports transactions.
MySQLi provides enhanced debugging capabilities.
Advertisements