Opening a file on a server opens a file

0

I am following these instructions but when I get to step 4 if I try to open localhost / booking or any subfolder of booking (including admin) or even another file I open the file db_conn.php so I can not see the control panel where I'm supposed to put that username and password:

The content of db_conn.php is:

<?php
$db_host = "localhost";
$db_user = "root";
$db_pass = "";
$db_name = "db";

try {
    /*connect as appropriate as above*/
    $db=mysqli_connect($db_host,$db_user,$db_pass,$db_name);} catch(Exception $ex) {
    echo "Cannot connect to database";
    die();
}
?>

Originally I came with PDO but I changed it because it gave me an error for some reason:

try {
    /*connect as appropriate as above*/
    $db = new PDO('mysql:host='.$db_host.';dbname='.$db_name.';charset=utf8', $db_user, $db_pass);
} catch(PDOException $ex) {
    echo "Cannot connect to database";
    die();
}
?>

If I put a echo in the try it shows it, so the connection is being made.

    
asked by Luis Carlos Gallegos 14.02.2018 в 08:27
source

0 answers