-4
 <?php
$conn=mysql_connect(`localhost'," root","") or die("Could not connect");
mysql_select_db("bng_nov",$conn) or die("could not connect database");
?>

Parse error: syntax error, unexpected end of file, expecting '`' in C:\xampp\htdocs\display\db.php on line 4

Moby M
  • 910
  • 2
  • 7
  • 26
  • Just replace the qoutes on localhost, like $conn=mysql_connect("localhost", " root", "") or die("Could not connect"); – Ankur Tiwari Dec 27 '17 at 07:45
  • 1
    You should also try looking into myssqli_ or PDO as mysql_ has been deprecated for some time and removed from the latest versions of PHP. – Nigel Ren Dec 27 '17 at 07:58

2 Answers2

1

Error in this line replace (`) with (') single quote. also remove space before root

$conn=mysql_connect('localhost',"root","") or die("Could not connect");

and best solution is use double quotes like this

$conn=mysql_connect("localhost","root","") or die("Could not connect");

also i mention that don't use mysql_*. you should used mysqli_*

i have add some DB connectivity codes. used this code

<?php
$servername = "localhost";
$username = "root";
$password = "";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
echo "Connected successfully";
?>
Bilal Ahmed
  • 4,005
  • 3
  • 22
  • 42
0

error in the below line

$conn=mysql_connect(`localhost'," root","")

please try like below

<?php
if (!$link = mysql_connect('localhost', 'root', '')) {
    echo 'Could not connect to mysql';
    exit;
}

if (!mysql_select_db('bng_nov', $link)) {
    echo 'Could not select database';
    exit;

}
?>
Moby M
  • 910
  • 2
  • 7
  • 26