How to connect to database using PHP and MySQL

<?php

$dbname="your db name";
$server="your server name e.g. localhost";
$username="your username e.g. root";
$password=" your password";

$connect = mysqli_connect($dbname,$server,$username,$password) or die(mysqli_error());

if($connect)
{

 echo "Database connection successfully..";
}else
{
echo "error while connecting  to the database";
}



?>

Comments

Popular posts from this blog

How to seperate character from string in php

How to Delete record using PHP Ajax

Uploads Only 10 files in month step by step