title: My PHP code will not let me insert into my mysql table
body: <p>I tried everything I could think of, I look at it over and over. I added <code>echo ();</code> to see if the problem was something else. Everything is spelled like it is on the server. I don't know what else to do. Please help!!</p>
  
  <pre><code>&lt;?php
  include('../lock.php');
  
  $username    =    $login_session;  
  $characterName    =    mysql_real_escape_string($_POST['characterName']);  
  $gender =    mysql_real_escape_string($_POST['gender']);   
  $height = "58" + rand(2, 20);   
  $weight = "120" * rand(2, 8);
  
  echo ($id . "&lt;br /&gt;");    
  echo ($username . "&lt;br /&gt;");  
  echo ($characterName . "&lt;br /&gt;");  
  echo ($gender . "&lt;br /&gt;");  
  echo ($height . "&lt;br /&gt;");   
  echo ($weight . "&lt;br /&gt;"); 
  
  if(isset($_POST['nc1'])) 
  
  {  
  $query    =    "INSERT INTO character(id, username, characterName, gender, height,   weight) VALUES ('$id', '$username', '$characterName', '$gender', '$height', '$weight')";  
  mysql_query($query) or die('Error: ' . mysql_error());  
  //header('location:success.php');   
  echo ("success");  
  }  
  ?&gt;
  </code></pre>
  
  <p>Jan 29, 2014 - I have made the updates you have suggested(but mysqli) and everything is echoing out correctly, the mysql_error() is returning blank but there is an error. POST is working. I still don't know how to fix it. The connection is also correct.</p>
  
  <p>I take that back, the error is: 
  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'character (id, username, characterName, gender, height' at line 1</p>