Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

How to Connect MySQL Database with PHP Websites

<?php
try{
    $sname = "localhost"; //just leave it as is 
    $uname = "test_name"; //the username 
    $password = "*************"; //the password

    $db_name = "test_db"; //the name of the db

    $conn = mysqli_connect($sname, $uname, $password, $db_name); //the connection
} catch(Exception $e){
    echo "activate your mySQL and add the user_db with all the values
";
    exit();
}
?>
 
PREVIOUS NEXT
Tagged: #How #Connect #MySQL #Database #PHP #Websites
ADD COMMENT
Topic
Name
3+6 =