php connect database phpmyadmin code example
Example 1: mysql connection phpmyadmin
<?php
echo "IT WORKS";
$con = mysqli_connect('localhost', 'root', 'root', 'unityaccess');
if(mysqli_connect_errno()) {
echo "1: Connection Failed";
exit();
}
?>
Example 2: using mysql database with php
<?php
$servername = "localhost";
$username = "yourusername";
$password = "yourpassword";
$conn = new mysqli($servername, $username, $password);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>