Tuesday, May 23, 2017

sql 42S22 error in Laravel (choosing a column I didn't mention)

I am doing a basic project in Laravel, when trying to delete an entry, it generates this error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'where clause' (SQL: select * from `employees` where `id` = 6 limit 1)

and it is true I don't have a column named 'id', instead I have employee_id, but why is it choosing id instead of employee_id?

Please explain from where did it bring this id column?



via M. Gamie

Advertisement