Welcome Guest, Not a member yet? Register   Sign In
Insert return false but inserts succesfully
#1

(This post was last modified: 08-13-2021, 01:44 AM by BFlokstra.)

I'm wreaking my brain, unable to figure this one out. 
I have the folowing code:
PHP Code:
if ($klantenModel->insert([
                        'id' => $this->request->getPost('id'),
                        'naam' => $this->request->getPost('naam'),
                        'woonplaats' => $this->request->getPost('woonplaats')
                    ]))
                {
                    return redirect()->to($_ENV['app.baseURL'] . 'klanten')->with('success''Gelukt.');
                }
                return redirect()->to($_ENV['app.baseURL'] . 'klanten')->with('error''Fout.'); 

What happens is dat the insert does what I expect (it inserts the data without a glitch), yet it returns false. And I can't figure out why. It doesn't insert empty columns, the data types of the respective columns in the database are correct (int for id and varchar(100) for the others). 

I hope you guys can help me figure out what the cause of this behavior is.
Reply
#2

Try thios and see what your query is looking like.
PHP Code:
$db->insertID();
$db->getLastQuery(); 

Please show it here.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB