1<?php
2$link = mysqli_connect('localhost', 'fake_user', 'my_password', 'my_db');
3
4if (!$link) {
5 die('Connect Error: ' . mysqli_connect_error());
6}
7?>
8 //The mysqli_connect_error() will return a list of connection error(s) if the connection to the db fails
1<?php
2$conn=mysqli_connect("localhost","username","password","database_name");
3?>
4
5This code will connect with database 'database_name' while $conn is connection name