32 Program to connect PHP with MySQL Database using mysqli_connect().

Program:

<?php
    $host = "localhost";
    $user = "root";
    $pass = "1234";
   
    $conn = mysqli_connect($host,$user,$pass);

    if(!$conn)
    {
        die('Could Not Connect:'.mysqli_errort());
    }
    else
    {
        echo "Connected Successfully: <br>";
        print_r($conn);
        mysqli_close($conn);
    }
?>


Output:

Program to connect PHP with MySQL Database.

Previous
Next Post »