0

i've come back to php and MySQL after I stopped coding,i still have the basics down, and i'm using old projects as a crutches,and I'm reusing some old files(like the ones made to generate a mysqli connection),I saved it in a file called 'conex.php'

$servername = "localhost";
$username = "root";
$password = "pass";
$base="base:name";


$conn = new mysqli($servername, $username, $password,$base);


if ($conn->connect_error) {
     die("Connection failed: " . $conn->connect_error);
} 

and it still works on the old project that I took it from, but now, when I open index.php that looks like this :

<?php

 include  "conex.php";
    echo "<html>
        <header></header>
        <body>";

//some random echo html

    echo"</body>";
?>

i get this displayed on browser:

connect_error) { die("Connection failed: " . $conn->connect_error); } ?>

So i do not know what is wrong as I am quite rusty and can't get the exact error number

Kousher Alam
  • 827
  • 1
  • 11
  • 27

1 Answers1

-2

what is your database name ?

have you try this tutorial, hope it is useful.

Here's [a link] http://php.net/manual/en/mysqli.connect-error.php

Mahendra Gohil
  • 366
  • 1
  • 3
  • 20