failed to INSERT INTO [table] error in your SQL syntax; check the manual that corresponds to your MariaDB server version
<p>I'm having trouble with inserting data into a <code>MySQL</code> database using <code>PHP</code> I've looked about around the website looking for similar results but I am not finding exactly what I'm looking for to be able to insert into my table.</p>

<p>I've simplified my code so if it is corrected it can be easily converted for other people to use in the own programs.</p>

<p>My problem is it always seems to fail no matter what way I write the code and fails in the same place it connects to the database and finds the <code>dbname</code> but can't put data in it.</p>

<p>The error I get from a website:</p>

<blockquote>
  <p>Error:  insert into accounts (Steam ID) VALUES ('YAY') You have an
  error in your SQL syntax; check the manual that corresponds to your
  MariaDB server version for the right syntax to use near 'ID) VALUES
  ('YAY')' at line 1</p>
</blockquote>

<pre><code>&lt;?php
$serverhost = "localhost";
$pass = "";
$dbname = "website_db";
$table = "";

// Create connection
$connect = mysqli_connect($serverhost, $user, $pass, $dbname);

// Check connection
if (!$connect) {
  die("Failed to connect to DataBase: " . mysqli_connect_error());
}

// SQL Variable
$sql = "insert into accounts (Steam ID) VALUES ('YAY')";

// SQL query
if (mysqli_query($connect, $sql)) {
  echo "Succesfully Inserted Data to Table";
} else {
  echo "Error: " . $sql . "&lt;br&gt;" . mysqli_error($connect);
}

// END
mysqli_close($connect);
?&gt;
</code></pre>