Connecting To The Database Using Mysqli

[Solved] Connecting To The Database Using Mysqli | Php - Code Explorer | yomemimo.com
Question : Connecting to the database using mysqli

Answered by : amused-ant-v10dzytnc082

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

Source : https://www.000webhost.com/forum/t/how-to-connect-to-database-using-php/42093 | Last Update : Thu, 28 Apr 22

Question : php connection mysqli database

Answered by : faheem-mehdi

<?php
$host="localhost";
$user="root";
$password="";
$db="attendance";
$conn=mysqli_connect($host,$user, $password, $db);
if(mysqli_connect_errno()){
echo "Connection Fail".mysqli_connect_error();
}
?>

Source : | Last Update : Thu, 17 Feb 22

Answers related to connecting to the database using mysqli

Code Explorer Popular Question For Php