Code has been added to clipboard!

Procedural Method of PHP Connecting to MySQL

Example
<?php
  $servername = "localhost";
  $username = "name_of_the_user";  
  $password = "users_password";
  
  // Create connection  
  $conn = mysqli_connect($servername, $username, $password);

  // Check connection  	
  if (!$conn) 
  {     
    die("Failed to connect: " . mysqli_connect_error());
  }
  echo "Connected successfully";  
?>