0

please help me get through with this. Everytime I update data from database there is '\' added before the single quote. For example I have an input that has a value=I'm ok after updating there is '\' will be added.

Sample code from my Model

    function update_questionnaire() {
          $Cid1 = $this->input->post('Cid1');
          $Cid2 = $this->input->post('Cid2');
          $Cdata = array(
            array(
                'choices_id' => $Cid1,
                'questionnaire_id_fk' => $Qid,
                'choices' => $choice1
            ),
            array(
                'choices_id' => $Cid2,
                'questionnaire_id_fk' => $Qid,
                'choices' => $choice2
            )
            );
            $question = $this->db->escape_like_str($this->input->post('question', TRUE));
            $this->db->update_batch('choices', $Cdata, 'choices_id');
      }

And sample code from my Controller

$this->form_validation->set_rules('choice1', 'Choice 1', 'required|trim');
$this->form_validation->set_rules('choice2', 'Choice 2', 'required|trim');

And sample code from my View

<?php 
$i=0;
foreach ($query as $row): 
$i++;
echo '<input type="text" name="choice' . $i . '" id="choice_' . $row->choices_id . '" value="' . trim_slashes($row->choices) . '" class="form-control"/>'; 
endforeach; 
?>
johnlopev
  • 97
  • 3
  • 16

0 Answers0