Database Connection in php

By using below code you can connect database with php application. After database connection we can access all database and also we can CRUD operation by using PHP application.


$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";

1 Comment. Leave new

I am sure this post has touched all the internet people, its really really fastidious article on building up new webpage.

Reply

Leave a Reply

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