I need to pull that history table 'date' field data into my base table under history with a dropdown box listing all dates the ID is listed in the relation table.
public function file()
{
$crud = new grocery_CRUD();
$crud->set_theme('bootstrap-v4');
$crud->set_table('file');
$crud->set_relation('ID', 'history', 'date');
$crud->fields('ID', 'lastname', 'firstname', 'middlename', 'phone', 'street', 'address2', 'city', 'zip', 'history', 'birthdate', 'registrationdate',' gender');
$crud->columns('ID', 'lastname', 'firstname', 'phone', 'city'', 'history');
$crud->set_subject('Customer File');
$crud->display_as('date', 'History')
$output = $crud->render();
$this->_grocery_crud_output($output);
}
function _grocery_crud_output($output = null)
{
$this->load->view('campaign.php',(array)$output);
}
}
The first thing that happens is the data in the ID column disappeared in my base table "file", the History field did not populate and I now get an sql error message when I try to view the full entry.
I suspect this is very straight forward for someone who knows how to set relation tables and data, but I just cannot figure out how to get this to work. I have read and reread the info on relations but it seems to rely on the primary key in the relation table which I cannot set with with mine because in the relation table the ID may well be listed multiple times.
Thanks so much for any help!
Since I posted this, I got the 'ID" in the History table set as foreign key thinking this might help, as well as the relation between the two tables in myphpadmin. But I am still getting the same result, it is not populating the 'file' table with the 'date' info from the History table.