Check out example codes for "mysqli connect". It will help you in understanding the concepts better.

Code Example 1

<?php

$con = mysqli_connect("localhost","my_user","my_password","my_db");

 
// Check connection

 if (mysqli_connect_errno()) {

  echo "Failed to connect to MySQL: " . mysqli_connect_error();

    
  exit();
}

?>

Code Example 2

<?php
$mysqli = new mysqli("localhost","my_user","my_password","my_db");

// Check connection
if ($mysqli -> connect_errno) {

  echo "Failed to connect to MySQL: " . $mysqli -> connect_error;
  
  exit();

  }
?>

Code Example 3

mysqli_connect ( "host", "username", "password", "database_name" )

Code Example 4

$con = mysqli_connect("hostname","username","password","database_name");

//pry want to make sure it connected ok
if (mysqli_connect_errno()){
	echo "MySQL Connection Error: " . mysqli_connect_error();
}

Learn ReactJs, React Native from akashmittal.com