Database is not getting update when there are letters and special characters in it

As the title said:
I have a input that when i type in the input the php code updates the database but the database is not getting updated when there are letters and special characters in it and i need to know how to fix it cuz its making me crazy.
This is the php code:

<?php header('Content-Type: text/html; charset=utf-8'); session_start(); include 'db.php'; $name = $_POST['name']; mysql_set_charset('utf8', $conn); $sql = "SELECT name FROM users WHERE name='$name'"; $result = mysqli_query($conn, $sql); $sql = "UPDATE users SET name = $name WHERE steamid = {$_SESSION['id']}"; $result = mysqli_query($conn, $sql); header("Location: account.php"); ?>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.