title: mysql_query(): supplied argument is not a valid MySQL-Link resource
body: <p>I have been trying to insert a sample piece of data from my form, but I always get a syntax error executing $result. </p>
  
  <p>The relevant part from index.php:</p>
  
  <pre><code>&lt;form method="post" action="form.php"&gt;
  &lt;ul &gt;
      &lt;li&gt;
          &lt;label for="accession_number"&gt;Accession Number&lt;/label&gt;
          &lt;input id="accession_number" name="accession_number" type="text" maxlength="6" value=""/&gt; 
      &lt;/li&gt;
  &lt;/ul&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and parts from form.php:</p>
  
  <pre><code>&lt;?php
  $connection = mysql_connect($server, $username, $password) or die('Could not connect'.mysql_error());
  mysql_select_db($database, $connection) or die("Cannot select db.");
  
  $accession_number = $_POST['accession_number'];
  
  $query = "INSERT INTO top (accession_number) ".
  "VALUES ($accession_number)";
  var_dump($query);
  mysql_error();
  
  $result = mysql_query($$query, connection) or die('Error querying database.');
  
  mysql_close($connection);
  ?&gt;
  </code></pre>
  
  <p>I don't know what I'm doing wrong.</p>