title: All values of JSON data are not inserted in MySQL Database (for UTF-8 characters)
body: <p>I get a text from a database in UTF-8 using JSON and it is in a file right now. When I print the data it is:</p>
  
  <blockquote>
    <p>توحید در نگاه امام علی (علیه السلام)</p>
  </blockquote>
  
  <p>But when I insert it in database I get this error:</p>
  
  <blockquote>
    <p>Insertion 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>
  </blockquote>
  
  <p>This is my code</p>
  
  <pre><code>&lt;?php 
  header('Content-Type: application/json; charset=utf-8');
  $con = mysql_connect("localhost","bbbbbbb","bbbbbbb");
  mysql_select_db("db", $con);
  if(file_exists('./json/file.json')){
      $jsondata = file_get_contents('./json/file.json');
      $data = json_decode($jsondata, true);
      foreach ($data['nodes'] as $node){
          $data_element = $node['node'];
          $title = $data_element['title'];
          $summary = $data_element['summary'];
          $body = $data_element['body'];
          $id = $data_element['id'];
          print $title."\n";
          $insert = "INSERT INTO main(title) VALUES ($title)";
          mysql_query($insert) or die("Insertion Error: ". mysql_error());
      }
  }
  else 
      print "File doesn't exist";
  </code></pre>
  
  <p>The database and its columns are all <code>utf8_general_ci</code>. Why the printed text is not same as the one that is inserted in Database?</p>