How do I connect to a MySQL database in PHP?
- Database name:
NewDB1
- Username :
Mark
- Password :
secret
I have googled a few solutions, but none of them seem to work.
How do I connect to a MySQL database in PHP?
NewDB1
Mark
secret
I have googled a few solutions, but none of them seem to work.
<?php
$servername = "localhost";
$username = "Mark";
$password = "secret";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>