 <p>You are using a mysql <code>RESERVED KEYWORD</code> in your query that is <code>key</code>, simply surround it with backtick ` to let database understand it is a column</p> <pre><code>$mysqli-&gt;query("INSERT INTO browsers(useragent, account, allowed, `key`, ip) VALUES('$ua', {$userR['id']}, 0, '(Key/token)', '(IP address)')"); </code></pre>