I have installed Xampp on my laptop recently and am trying to display the following query:
display.php
<?php
    // Send variables for the MySQL database class.
    $database = mysqli_connect('localhost', 'root', '','game_db') or die('Could not connect: ' . mysql_error());
   // mysql_select_db('my_database') or die('Could not select database');
 
    $query = "SELECT * FROM `scores` ORDER by `score` DESC LIMIT 5";
    $result = mysqli_query($database,$query) or die('Query failed: ' . mysql_error());
 
    $num_results = mysql_num_rows($result);  
 
    for($i = 0; $i < $num_results; $i++)
    {
         $row = mysql_fetch_array($result);
         echo $row['name'] . "\t" . $row['score'] . "\n";
    }
?>
I have this xampp installed in my 'A' Drive and this file is saved in htdocs folder of xampp but whenever i run it as localhost/display.php in any browser it gives me this error:
 Parse error: syntax error, unexpected '$query' (T_VARIABLE) in 
    A:\xampp\htdocs\display.php on line 6
I have done the same things on various laptops on my friends they work with the same code but not on mine, why?
 
    