title: Insert into specific column mysql database php
body: <p>I want to enter data into my mysql db but into a specific row, when the user enters a number and clicks a button. For example, if the user logged in, is called 'user', then the data which is entered will go into a column called 'ticket' which is in the same row as the username 'user'. </p>
  
  <p>I have written the code for it to go into the db but in a new row:</p>
  
  <p>Code for page which user enters the data:</p>
  
  <pre><code>&lt;?php require('check.php')?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;&lt;?php echo $row['username']; ?&gt; Profile&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;p style="float: right"&gt;&lt;a href="logout.php"&gt;LOG OUT&lt;/a&gt;&lt;/p&gt;
  &lt;?php
  include ('connect.php');
  
  $user_id= $_SESSION['id'];
  $sql = "SELECT username FROM user WHERE user_id = '$user_id'";
  
  $result = mysql_query($sql) or die('Query failed. ' . mysql_error());
  $uname = mysql_fetch_array($result);
  
  $user_id= $_SESSION['id'];
  $sql = "SELECT email FROM user WHERE user_id = '$user_id'";
  
  $result = mysql_query($sql) or die('Query failed. ' . mysql_error());
  $uemail = mysql_fetch_array($result);
  
  echo "Hello" . " " . $uname['username'];
  ?&gt;
  
  
               &lt;h1&gt;Choose ticket Amount&lt;/h1&gt;
               &lt;hr /&gt;
               &lt;form method="post" action="addticket.php"&gt;
               &lt;label for="elliegoulding"&gt;Ellie Goulding Ticket Amount: &lt;/label&gt;
               &lt;input type="text" name="elliegoulding" max="3" maxlength="3" /&gt;&lt;br /&gt;
               &lt;br /&gt;
               &lt;input type="submit" value="Add ticket"/&gt;
               &lt;br /&gt;
               &lt;hr /&gt;
               &lt;div id="footer"&gt;
               &lt;/div&gt;
           &lt;/form&gt;
  
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Code for php page which processes information and adds to db:</p>
  
  <pre><code>&lt;?php
  $elliegoulding = $_REQUEST["elliegoulding"];
  
  
  $linkme = mysql_connect("mysql.cms.gre.ac.uk","ta210","*****");
  if (!$linkme)
      die ("Could not connect to database");
  mysql_select_db("mdb_ta210", $linkme);
  
  $query = "INSERT INTO user (ticket) VALUES ('$elliegoulding, Ellie Goulding Tickets')";
  mysql_query ($query, $linkme)
      or die ("Ticket purchase failed.");
  
  echo ("You have just bought $elliegoulding Ellie Goulding tickets");
  
  mysql_close($linkme);
  ?&gt;
  </code></pre>
  
  <p>Like I said the above code works and enters it into the database but just into a new row.
  Any help or suggestions would be great.</p>