Database in PHP
- To store data in tabular form and categorically, databases are used.
- PHP can also use databases to store data in tabular form and sort it in categories.
- The most common database that is used in PHP is MySQL.
- This is a free database system, and comes with the Wampserver software you may have installed at the start of the course.
MYSQL in PHP
- MySQL is a popular database system that was developed and distributed by ORACLE.
- It is commonly used on the web i.e. it runs on server. It is very much trusted database system.
- It is suitable for both small and large applications.
- MySQL basically uses standard SQL.
- It is much popular because of its simplicity and fast speed and also because of being free of cost.
- MySQL is named after its 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.
We can use connect to and manipulate any databases with PHP. However MySQL is the most popular database system used with PHP.
- Queries are a kind of commands or requests which are used to ask the MySQL server to perform some action on the database.
- Before writing the queries, a database must be connected using mysqli_connect() function.
- The Queries must be added to a php function to bring in effect. The function is mysqli_query(), which is used to execute all the queries in MySQL.
- This function takes mainly two parameters-
- link= This is the link to the MySQL server. The result of function mysqli_connect() is used here.
- query= This is the query that is to be executed. Query is always in the form of string.
- You have installed the MySQL server automatically if you have installed wamp server. Besides, if you want to download it, you can go to http://www.mysql.com.