Answers for "sql database connectivity"

SQL
0

sql database connectivity

<?php
$db_host = "localhost";
$db_user = "your database username";
$db_password = "your database password";
$db_name = "your database name";

$conn =  mysqli_connect($db_host, $db_user, $db_password, $db_name);
// mysql_connect($db_host, $db_user, $db_password) or die('error');
// mysql_select_db('db_name')  or die('db not found');
// echo 'connected';

if(!$conn->connect_error){
    die("connection failed ". mysqli_connect_error());          
}
    // echo"connected";
    if(mysqli_query($conn, $db_name)){
        echo "Database created";
    }else{
        echo "error creating database";
    }
    mysqli_close($conn);


?>
Posted by: Guest on June-13-2021

Code answers related to "sql database connectivity"

Code answers related to "SQL"

Browse Popular Code Answers by Language