0

I'm trying to workout a login script which has a login form and a set of required files, among them db_connection.php (below)

<?php
define("DB_SERVER", "localhost");
define("DB_USER", "LoginSystem");
define("DB_PASS", "secret");
define("DB_NAME", "login2015");

$connection = mysqli_connect(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
if(mysqli_connect_errno()) {
die("Database connection failed: " . 
     mysqli_connect_error() . 
     " (" . mysqli_connect_errno() . ")"
);
}
?>

when trying to run index.php I get the following error

Parse error: syntax error, unexpected '"login2015"' (T_CONSTANT_ENCAPSED_STRING) in C:\xampp\htdocs\login\includes\db_connection.php on line 5

changing the name of the DB_NAME constant or replacing double quotes by single quotes does nothing. What's more. Even changing the DB_NAME constant to something entirely different yields the exact same error, including "'login2015'" as part of the error message even though the constant is no longer defined as that.

Might it have something to do with php.ini configuration cache or something of the sort? Thanks for the help!

tigerbluejay
  • 171
  • 8
  • Can't reproduce this error. – Rizier123 May 15 '15 at 17:02
  • What's your PHP version? Also there possibly could be some \n\r problems. You can try to erase the whole string and just retype it. – Axalix May 15 '15 at 17:08
  • @Axalix php version 5.6.3, tried erasing the whole string, even without a constant defined I'm getting the exact same error. – tigerbluejay May 15 '15 at 17:27
  • The suggested duplicate question says nothing about why I am getting the same error even after deleting the constant, nor is it clear by the script or the answers of the duplicate question why I am getting this error even though the syntax of the script has no problems – tigerbluejay May 15 '15 at 17:53

0 Answers0