$builder->insert($data); not work |
Hi all,
I have a problem with a insert in a database. This is the controller: PHP Code: ...... This is model: PHP Code: public function insert_auto($data) The query printed is "SELECT * FROM `veicoli`" instead of "INSERT INTO veicoli ....." Why ? Can you help me ? -------------- Edit: Codeigniter 4.0.4
Because you are using getCompiledSelect. That returns the SELECT query. Try getCompiledInsert instead.
Thank you!
I make a partially fix.. but now I have this error: "message": "Call to undefined method CodeIgniter\\Database\\MySQLi\\Connection::insert()" I think that the error isn't in insert but in the connection: PHP Code: $db = \Config\Database::connect();
Can't really tell why it's not connecting. Enabled development environment and check the logs. You are however using insert() incorrectly.
https://codeigniter.com/user_guide/datab...rting-data |
Welcome Guest, Not a member yet? Register Sign In |