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

前端 未结 5 1845

I am trying to get specific data from the database by using column SongID when a user clicks a link but I am getting this error:

SQLSTATE[42

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-02 08:25

    Just Go to Model file of the corresponding Controller and check the primary key filed name

    such as

    protected $primaryKey = 'info_id';
    

    here info id is field name available in database table

    More info can be found at "Primary Keys" section of the docs.

提交回复
热议问题