In this tutorial I will show you how to connect in database in PHP and MySQL.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is and

Program Listing

$servername = "localhost";
$database = "crud";
$username = "root";
$password = "";

// Create connection

$conn = mysqli_connect($servername, $username, $password, $database);

// Check connection

if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);

echo "Connected successfully to the database.";



Leave a Reply

Your email address will not be published. Required fields are marked *