Link to home
Start Free TrialLog in
Avatar of Yong Scott
Yong ScottFlag for Malaysia

asked on

PHP FILE

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

Open in new window


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

I got the error
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Perhaps ` should be '
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well, you changed the first \` to a \" which will generate the same error.

You must balance your quotes around localhost, so try "localhost" or 'localhost'. Whatever quote you use must be the same to start + end localhost.

Reread Shaun's comment carefully again. He suggested you change the leading \` to match the trailing \' around localhost.
Hey David.

Oops - that was a typo in my code, not the Authors ;)
Avatar of Yong Scott

ASKER

guys i settle it already i use
<?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";
?>

Open in new window