Welcome Guest, Not a member yet? Register   Sign In
SIngle quote on model save
#1

Hi this is a simple part of my code :

Code:
                $post = $this->request->getPost();


                $res=$users_model->save($post);
I have some surname with singol quote and in db is not inserted the part after single quote , why ?
Reply
#2

There might be better solutions, but one is to escape the surname string before saving it:
Code:
$post['surname'] = $this->db->escape($post['surname']);
Reply
#3

@pippuccio76 Your code should work. Did you override the save() method?
Reply
#4

(05-13-2024, 06:54 PM)kenjis Wrote: @pippuccio76 Your code should work. Did you override the save() method?

no i don't override , data are saved but singol quote truncate post data
Reply
#5

Check the actual SQL statement.
See https://codeigniter4.github.io/CodeIgnit...ql-queries
Reply




Theme © iAndrew 2016 - Forum software by © MyBB