title: Mysql- syntax to use near '' at line 1
body: <p>Hi guys here's my code I've faced with such error:
  """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 '' at line 1"""</p>
  
  <pre><code>    &lt;?php
  $con = mysql_connect("localhost","root","");
  if(!$con){
  die('could not connect' .mysql_error());
  }
  
  mysql_select_db("phptest",$con);
  
  $insert="INSERT INTO persons (FirstName,LastName)VALUES('$_POST[firstname]','$_POST[lastname]'";
  if(!mysql_query($insert,$con))
  {
      die('error:' .mysql_error());
  }
  echo "1 record added";
  
  mysql_close($con);
  
  ?&gt;
  </code></pre>
  
  <p>simple code but I don't know where's wrong....</p>