<h1>Members List</h1> <table border="1"> <tr> <th>First Name</th> <th>Last Name</th> <th>Country</th> <th>College</th> </tr> <?php // Open a connection to the database //Using PHP with MySQL $link = mysqli_connect('localhost', 'pal', '123456', 'globall'); // Define a query that retrieves the first name and last // name of every employee $query = "SELECT name, lastname, country, college FROM users"; // Run the query and store the result $result = mysqli_query($link, $query); // Close the connection to the database mysqli_close($link); // Assign each record in the result to an array while ($row = mysqli_fetch_array($result)) { // Assign each database array element to a variable $name = $row['name']; $lastname = $row['lastname']; $country = $row['country']; $college = $row['college']; // Display each record in a separate row of the table echo <<<END <tr> <td>$name</td> <td>$lastname</td> <td>$country</td> <td>$college</td> </tr> END; } ?> </table> I am getting error when running this code on my localhost. Parse error: syntax error, unexpected T_SL in C:\xxx\xampp\htdocs\user.php on line 49 Line 49 is echo <<<END
please use code tags! please submit to the right forum. print, sprint, printf, echo AND PLEASE don't close the connection before you have got all information you want. So put // Close the connection to the database mysqli_close($link); at the end of your script!