• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unknown column in order clause

#1
Hello everyone! 

I've a problem returning the first row of the result set with the first() method (i suppose).


PHP Code:
Unknown column 'games.id' in 'order clause' 

This is the Migration
   

This is the GamesModel
   

This is the Games Controller
   

If a change the id filed in "id" everything works fine. 

Does It is a convention to follow?

If yes, how can i bypass this behaviour?

Thank you all. 

PS Version 4 is awesome! Great work.
Reply

#2
I think you just need to tell CI the name of your primary key. The default is “id” when you don’t set a specific name: https://codeigniter4.github.io/userguide...your-model

PHP Code:
protected $primaryKey 'game_id'
Test your translation files with Translation Tester
Reply

#3
Oh sure. I'm a complete fool! It's working as it should now.

Thanks you so much for the reply and the link too!
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.