I have a MySQL DB from where i next to extract data based on user search.
I have no problem displaying the post variable like this :
<?php
if (isset($_POST)) {
$name = htmlspecialchars($_POST['name']);
echo "Results - " . $name ."\n";
}
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "test";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
$conn->close();
?>
The error -
Parse error: syntax error, unexpected end of file.
As soon as I add a MySQL connection, without even any query to be done, I get a parse error. Why is that ?
I have tried adding a specific query as I need the results displayed.
I have also tried using a different from of submitting, still no luck, getting same parse error.