title: mysql table insert error
body: <p>hi guys thanks for time.
  am getting a mysql error  here is my php code used </p>
  
  <pre><code>if(isset($_POST["content_txt"]) &amp;&amp; strlen($_POST["content_txt"])&gt;0) 
  {   //check $_POST["content_txt"] is not empty
  
      //sanitize post value, PHP filter FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH Strip tags, encode special characters.
      $contentToSave = filter_var($_POST["content_txt"],FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH); 
  
      // Insert sanitize string in record
      $insert_row = $mysqli-&gt;query("INSERT INTO f_add_course(content) VALUES('".$contentToSave."')");
  
      if($insert_row)
      {
           //Record was successfully inserted, respond result back to index page
            $my_id = $mysqli-&gt;insert_id; //Get ID of last inserted row from MySQL
            echo '&lt;li id="item_'.$my_id.'"&gt;';
            echo '&lt;div class="del_wrapper"&gt;&lt;a href="#" class="del_button" id="del-'.$my_id.'"&gt;';
            echo '&lt;img src="images/icon_del.gif" border="0" /&gt;';
            echo '&lt;/a&gt;&lt;/div&gt;';
            echo $contentToSave.'&lt;/li&gt;';
            $mysqli-&gt;close(); //close db connection
  
      }else{
  
          //header('HTTP/1.1 500 '.mysql_error()); //display sql errors.. must not output sql errors in live mode.
          header('HTTP/1.1 500 Looks like mysql error, could not insert record!');
          exit();
      }
  </code></pre>
  
  <p>and its not inserting the data </p>
  
  <pre><code>$insert_row = $mysqli-&gt;query("INSERT INTO f_add_course(content) VALUES('".$contentToSave."')");
  
  if($insert_row)
  </code></pre>
  
  <p>its skipping the if condition and no data is inserted into table hank in advance</p>