title: Inserting check box data in mysql using php
body: <p>I am creating a form where a user tick on the checkbox then 1 will be stored in that column on MySQL table. If the user does not tick then 0 will be stored on that field in the database. One checkbox for one column. My HTML code is :</p>
  
  <pre><code> Type ;&lt;label class="checkbox-inline"&gt;&lt;input type="checkbox" name="mentor" value="1" &gt;Mentor&lt;/label&gt;
  
    &lt;label class="checkbox-inline"&gt;&lt;input type="checkbox" name="core" value="1" &gt;Core&lt;/label&gt;
  </code></pre>
  
  <p>and my PHP code is </p>
  
  <pre><code> $name = mysqli_real_escape_string($DBcon, $_POST['name']);
      $mentor;
      if (isset ($_POST['mentor']) == "1")
      {   
          $mentor = 1;
  
      } 
      else 
      {  
           $mentor = 0;
      }
      $core;
      if (isset ($_POST['core']) == "1")
      {   
          $core =1;
  
      } 
      else 
      {  
           $core =0;
      }
      $insert = $DBcon-&gt;query("INSERT into contributor(name,mentor,core) VALUES('$name','$mentor','$core')");
  </code></pre>
  
  <p>But I am getting "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 '????\"Exif\0\0MM\0*\0\0\0\0\0\0\0\0\0?\0\0\0\0\0\0?\0\0\0\0\0\0\' at line 1"
  this error when I press submit button </p>