Error inserting into DB

-4

Well, I'm having a problem signing up for a client on DB. When I click on the register button, it only refreshes the page and does not insert the client into the database. No error appears and nothing. Just update the form and you're done. When I take the array data (from image 2) and I put only one echo to see if it runs, it appears that it was inserted, but when I use this data with the array that is instantiated to insert into the DB, it does not insert. What can it be? To get these lessons from youtube and my code is the same way I saw it and the guy does not respond.

    
asked by anonymous 19.12.2017 / 03:19

1 answer

1

The fact that the code does not show the error is because you are returning false when an error is cast to try..catch .

  

Tip: Avoid doing this. Always treat errors and always store these errors in a log, so you'll know how your code is behaving.

The error is in the if ($inserir->execute()($pegaValores)); line. The correct one would be (I think, because I do not know the video lesson) if ($inserir->execute($pegaValores)); . You have more relatives.

    
19.12.2017 / 03:29