Here’s my code:
<?php db_connect.php
echo "connecting to DB..."
$host = "localhost";
$user = "root";
$pass = "*****";
$databaseName = "atlas_test";
$tableName = "sites";
$con = mysql_connect($host, $user, $pass);
if(!$con){
die ('Could not connect: ' . mysql_error());
}
echo "DB connect successful..."
?>
…and I’m getting the following error message when attempting to run the page:
“parse error…expecting ‘,’ or ‘;’ in db_connect.php, line 4…”
echo needs to end with a ;.
This is not a connection error; a basic PHP mistake. The parse error is a good hint. Missing ; errors will often have the error line on the next, because that’s where php first notices it should have seen a ; on the line before.