6

I need to save in database category like "a & b" but the model save in database just "a" miss the blank space and the &.

This is the array:

$data = array('avenvu'        => $_POST['avenvu'],
              'brand'         => $_POST['brand'],
              'category'      => $_POST['category'],
              'description'   => $_POST['description'],
              'man_women_shop'=> $_POST['man_women_shop'],
              'postdatetime'  => date("Y-m-d H:i:s",time()), 
              'publish'       => 1,  
              'user_id'       => $this->session->userdata('user_id'));

$result = $this->personal_closest->insertCloset($data);

And this is the model:

function insertCloset($data) {
    $this->db->insert('personal_closest',$data);
}
4
  • remove htmlspecialchars and try. and try to change column collasion to utf-8-bin. at the time of shoeing category htmlspecialchars will be needed. Commented Apr 18, 2015 at 9:44
  • same error i've try. Commented Apr 18, 2015 at 9:45
  • ok write mysqli_real_escape_string($_POST['category']); Commented Apr 18, 2015 at 9:47
  • mysqli_real_escape_string() need 2 parameters Commented Apr 18, 2015 at 10:02

1 Answer 1

3

Change your insertCloset function:

function insertCloset($data) {

    $personal['avenvu']         =  $data['avenvu'];
    $personal['brand']          =  $data['brand'];
    $personal['category']       =  $data['category'];
    $personal['description']    =  $data['description'];
    $personal['man_women_shop'] =  $data['man_women_shop'];
    $personal['postdatetime']   =  $data['postdatetime'];
    $personal['publish']        =  $data['publish'];
    $personal['user_id']        =  $data['user_id'];

    $this->db->insert('personal_closest',$personal);
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.