In this article shows PHP functions are available to connect to a MySQL database PHP Data Object (PDO) and odbc_connect function. PHP has a rich collection of built in functions for manipulating MySQL databases.
The mysqli_connect function is used to connect to a MySQL database server.
OR
Code Details:
- $database_handle: is the database connection resource variable.
- mysqli_connect(…): is the function for connecting to the database
- $database_server_name: is the name or IP address of the server hosting MySQL server.
- $database_user_name: is a valid user name in MySQL server.
- $database_password: is a valid password associated with a user name in MySQL server.
The mysql_select_db function is used to select a database. It has the following syntax.
- mysql_select_db(…): is the database selection function that returns either true or false
- $database_name: is the name of the database
- $link_identifier: is optional, it is used to pass in the server connection link.
The mysql_query function is used to execute SQL queries. The function can be used to execute the following query types:
- Insert
- Select
- Update
- delete
- mysql_query(…):is the function that executes the SQL queries.
- $query :is the SQL query to be executed
- $link_identifier: is optional, it can be used to pass in the server connection link
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.