title: Insert single and double quotes in a wordpress database
body: <p>I'm trying to save some titles to a mysql database in wordpress allowing double and single quotes. So I want to be able to insert strings such as:</p>
  
  <pre><code>    A man's dog walked into the bar
      The "main reason" it does not work
      It's time to announce "The Show" in an hour
  </code></pre>
  
  <p>My code looks like such:</p>
  
  <pre><code>    $question_id = filter_var($_REQUEST['question_id'], FILTER_SANITIZE_NUMBER_INT);
      $feedback_correct = preg_replace("/[^a-zA-Z0-9'\"?_\. !&amp;-]+/","",sanitize_text_field($_REQUEST['feedback_correct']));
      $feedback_incorrect = preg_replace("/[^a-zA-Z0-9'\"?_\. !&amp;-]+/","",sanitize_text_field($_REQUEST['feedback_incorrect']));
      //preg_replace is to strip out any characters we dont want in the title like "&lt;&gt;|}{[]/"
      $data = array(
      'feedback_correct' =&gt; $feedback_correct,
      'feedback_incorrect' =&gt; $feedback_incorrect
      );
  
      $update_feedback = $eot_quiz-&gt;updateQuestion($data, $question_id);
  </code></pre>
  
  <p>And the updateQuestion function:</p>
  
  <pre><code>        public function updateQuestion($data = array(), $id = 0)
          {
          global $wpdb;
          $result = $wpdb-&gt;update(TABLE_QUIZ_QUESTION, $data, array('ID' =&gt; $id));
              if ($result === false) 
              {
                  return false;
              } 
              else 
              {
                  return true;
              }
          }
  </code></pre>
  
  <p>After the trip to the database, my strings look like:</p>
  
  <pre><code>    A man
  </code></pre>
  
  <p>*string is cut off after the single quotes</p>
  
  <pre><code>    The "main reason" it does not work
  </code></pre>
  
  <p>*look ok with double quotes</p>
  
  <pre><code>    It
  </code></pre>
  
  <p>*string is cut off after the single quote </p>
  
  <p>How do I get these strings inserted correctly in the db? Thanks in advance.   </p>
  
  <p>Display Code:</p>
  
  <pre><code>     &lt;?php
        $quiz_question = $eot_quiz-&gt;get_question_by_id($question_id);
  
        ?&gt;
         &lt;div class="bs"&gt;
           &lt;div class="panel panel-default"&gt;
              &lt;form method="POST" action="#"&gt;
                  &lt;div class="panel-heading"&gt;
                    &lt;h3 class="panel-title"&gt;&lt;?= $quiz_question['quiz_question']?&gt;&lt;/h3&gt;
                  &lt;/div&gt;
                  &lt;div class="panel-body"&gt;
  
                  &lt;div class="form-group"&gt;
                    &lt;label for="feedback_correct"&gt;Feedback for correct answer&lt;/label&gt;
                    &lt;input type="text" class="form-control" name="feedback_correct" placeholder="Correct Feedback" value='&lt;?= $quiz_question['feedback_correct']?&gt;'&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                    &lt;label for="feedback_incorrect"&gt;Feedback for incorrect answer&lt;/label&gt;
                    &lt;input type="text" class="form-control" name="feedback_incorrect" placeholder="Incorrect Feedback" value='&lt;?= $quiz_question['feedback_incorrect']?&gt;'&gt;
                  &lt;/div&gt;
                  &lt;input type='hidden' name='question_id' value="&lt;?= $question_id ?&gt;" /&gt;
                  &lt;input type='hidden' name='quiz_id' value="&lt;?= $quiz_id ?&gt;" /&gt;
                  &lt;input type='hidden' name='subscription_id' value="&lt;?= $subscription_id ?&gt;" /&gt;
                  &lt;input type='hidden' name='feedback' value="true" /&gt;
                  &lt;button type="submit" class="btn btn-default"&gt;Update Feedback&lt;/button&gt;
  
          &lt;/div&gt;
          &lt;div class="panel-footer"&gt;&lt;a href="/dashboard/?part=update_quiz_questions&amp;question_id=&lt;?= $question_id?&gt;&amp;quiz_id=&lt;?= $quiz_id?&gt;&amp;subscription_id=&lt;?= $subscription_id ?&gt;" class="btn btn-success pull-right"&gt;Take me back to the Question&lt;/a&gt;&lt;div style="clear:both"&gt;&lt;/div&gt;&lt;/div&gt;
           &lt;/form&gt;
         &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>