mysqli connect

C++
<?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();

  }
?>
 mysqli_connect ( "host", "username", "password", "database_name" )
$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();
}<?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();
}

?>
 
Source

Also in C++: