title: #1064 - You have an error in your SQL syntax;near '@gmail.com, ewefasd asdsd)'
body: <p>i am trying to insert data to mysql table using php i tried so many times but i can't figure out what's problem here. i tried to display query using <strong>echo</strong>. it's displaying this.</p>
  
  <pre><code>INSERT INTO `inquiry` (id,name,contact,email,query) values ('',vijay,15461485,asasf@gmail.com, ewefasd asdsd)
  </code></pre>
  
  <p>and my php query is this.</p>
  
  <pre><code>&lt;?php
  include('config.php');
  if (isset($_POST['submit'])) {
  $name=$_POST['userName'];
  $mail=$_POST['userMail'];
  $phone=$_POST['userPhone'];
  $msg=$_POST['userMsg'];
  function test_input($data) {
  $data = trim($data);
  $data = stripslashes($data);
  $data = htmlspecialchars($data);
  return $data;
  }
  test_input($name);
  test_input($mail);
  $query="INSERT INTO `inquiry` (id,name,contact,email,query) values ('',$name,$phone,$mail,$msg)";
  $qur=mysql_query($query);
      if ($qur) {
          header('location:'. $_SERVER['HTTP_REFERER']);
      }
      else {
          echo $query;
      }
  }
  ?&gt;
  </code></pre>
  
  <p>when i try that display query to mysql it's displaying like this.</p>
  
  <pre><code>#1064 - 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 '@gmail.com, ewefasd asdsd)' at line 1
  </code></pre>
  
  <p>what's problem here,i don't know,please help me.</p>