mysqli_connect : 

PHP 5 and above support the mysqli_connect() function. mysqli_connect is a predefined function in PHP which used to establish a connection with the database.
In the mysqli_connect function, we need to provide some parameters for security and connection shake.
if the given parameters are correct then the connection got established with the database.

mysqli_connect


How many parameters are required for mysqli_connect function in PHP?
In mysqli_connect we need to provide 4 parameters that are described below:


  • Host Name
  • DB user name
  • DB Password
  • DB Name
DB stands for DataBase.

Host Name: 
Hostname is the place where your site is host now if the website and database have the same hosting then there we use localhost if they have a different place then we need to provide the IP or address of the database hosting.


DB user name, DB Password, DB Name:
you are familiar with three DB user name, DB Password, DB Name when you create DB then this is provided by you.
if you are using your local PC to host the site then the by default the
 DB user name: root
 DB Password: null(nothing)

Example of mysqli_connect:

$link mysqli_connect("localhost""db_user""""my_db");

In this post, we explain mysqli_connect() function if you want to ask something related to this then describe it in the comment section.

Post a Comment

Previous Post Next Post