Hi!
I'm getting this PHP syntax error on line 87 of my file.
ERROR: PHP Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
The function works fine, if I take the function out of that file and put it into a separate file, it works fine.
function get_UserId($username){
include('config.php');
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT id FROM users WHERE username='$username'";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
$id = $row['id'];
$conn->close();
return $id;
}
Thanks