This site is mobile accessible. Press the "Tap Here" button to use a different font-size.
Smartphone icons created by Freepik - Flaticon
8.1 MySQL Database
- With PHP, you can connect to and manipulate databases.
- MySQL is the most popular database system used with PHP.
What is MySQL?
- MySQL is a database system used on the web
- MySQL is a database system that runs on a server
- MySQL is ideal for both small and large applications
- MySQL is very fast, reliable, and easy to use
- MySQL uses standard SQL
- MySQL compiles on a number of platforms
- MySQL is free to download and use
- MySQL is developed, distributed, and supported by Oracle Corporation
- MySQL is named after co-founder Monty Widenius's daughter: My
- The data in a MySQL database are stored in tables. A table is a collection of related data, and it consists of columns and rows.
- Databases are useful for storing information categorically. A company may have a database with the following tables:
- Employees
- Products
- Customers
- Orders
PHP + MySQL Database System
- PHP combined with MySQL are cross-platform (you can develop in Windows and serve on a Unix platform)
Database Queries
- A query is a question or a request.
- We can query a database for specific information and have a recordset returned.
- Look at the following query (using standard SQL):
SELECT LastName FROM Employees
The query above selects all the data in the "LastName" column from the "Employees" table.
Download MySQL Database
If you don't have a PHP server with a MySQL Database, you can download it for free here: http://www.mysql.com
Facts About MySQL Database
- MySQL is the de-facto standard database system for web sites with HUGE volumes of both data and end-users (like Facebook, Twitter, and Wikipedia).
- Another great thing about MySQL is that it can be scaled down to support embedded database applications.
- Look at http://www.mysql.com/customers/ for an overview of companies using MySQL.
Navigate this module
Eventually the navigation links, above, will be replaced by these << (previous) and >> (next) buttons below.
Animated PHP icons used in the buttons provided by ICONS8.COM.
Smartphone icons created by Freepik - Flaticon
Example files created in this module:
MySQLi Object-Oriented connection
MySQLi Procedural connection
MySQL PDO connection
Create database using MySQLi Object-oriented
Create database using MySQLi Procedural
Create database using PDO
Create database table using MySQLi Object-oriented
Create database table using MySQLi Procedural
Create database table using PDO
Insert data using mySQLi OO
Insert data using mySQLi Procedural
Insert data using PDO
Get Last Guests ID OO
Get Last Guests ID Procedural
Get Last Guests ID PDO
Insert Multiple Records OO
Insert Multiple records Procedural
Insert Multiple records PDO
Prepared Statements OO
Prepared Statements PDO
My Guests mySQLi OO
Selecting guests (mySQLi Procedural)
My Guests (PDO)
Where Filter mySQLi OO
Where Filter mySQLi Procedural
Where Filter PDO
Order By mySQLi OO
Order By mySQLi Procedural
Order-by PDO
Delete Guests mySQLi OO
Delete Guests mySQLi Procedural
Delete Guests PDO
Update Guests mySQLi OO
Update Guests mySQLi Procedural
Update Guests PDO
My Customers