title: Blank row inserted before new data row in Mysql database
body: <p>A blank row is being inserted before, and along with the actual data row, in my MySQL database. Why is this?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;?php
  
  define('DB_NAME','my_db_name');
  define('DB_USER','my_db_user');
  define('DB_PASSWORD','my_db_pass');
  define('DB_HOST','localhost');
  
  $link = mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
  
  if (!$link){
   die('Could no connect'.mysql_error());
  
  }
  
  $db_selected = mysql_select_db(DB_NAME, $link);
  
  if(!$db_selected){
   die('Can\'t no connect'. DB_NAME .':'.mysql_error());
  
  }
  
  $name = $_POST['name'];
  
  $sql ="INSERT INTO demo (name) VALUES ('$name')";
  
  if(!mysql_query($sql)){
  
    die('Error:'.mysql_error());
  }
  
  mysql_close();
  
  ?&gt;
  &lt;html&gt;
  &lt;body&gt;
  &lt;form  action="demo2.php" method="post"&gt;
  &lt;input id="name" name="name" type="text" placeholder="" class="form-control input-md" required=""&gt;
  &lt;input type="submit" class="btn btn-success" value="Add Client"&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is my MySQL database structure:</p>
  
  <p><a href="https://i.stack.imgur.com/L4rxu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L4rxu.jpg" alt="Mysql database Structure"></a></p>
  
  <p>Here is the table with a blank entry before the "gunk" name data entry:</p>
  
  <p><a href="https://i.stack.imgur.com/STGl7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/STGl7.jpg" alt="enter image description here"></a></p>
  
  <p>I have taken the time to isolate this issue down to one form input with a successful database connection and my data is added, just with  blank row before it.</p>
  
  <p>Why am I getting a blank row inserted before new data row in my database?</p>