Hey all,
This is going to sound like an amateur question but here it goes.
I have two tables... "Teams" and "Players".
Teams has "id" and "team_name". The "Players" table has a field called "team_id" which relates to "teams.id". Follow so far?
So basically.. what I want to do is, instead of showing the team id, I want to show the team_name. (example: teams.id=1, teams.team_name="Mets", players.team_id=1)
I can't for the life of me figure out how to do this with Grocery Crud. I know how to do it with regular mySQL code. Here is what my controller looks like so far.
public function manage_players() { $crud = new grocery_CRUD(); $crud->set_theme('datatables'); $crud->set_table('players'); $crud->display_as('number', 'Player Number'); $crud->display_as('name', 'Player Name'); $crud->display_as('position', 'Position'); $crud->display_as('height', 'Height'); $crud->display_as('weight', 'Weight'); $crud->display_as('dob', 'Birthday'); $crud->display_as('shoots', 'Shoots'); $crud->display_as('gp', 'Games Played'); $crud->display_as('goals', 'Goals'); $crud->display_as('assists', 'Assists'); $crud->display_as('points', 'Points'); $crud->display_as('image', 'Player Photo'); $crud->set_field_upload('image', 'assets/images/players'); $crud->set_relation('what goes here'); $output = $crud->render(); $this->_players_output($output); }
PS- This is for a hockey league project I am working on for my kid.
Thanks for any help...
Derek