I made a form for adding factories to my database. this works great but i can't show my factories on the page because they're in a joined table, but when i submit the page it does not add an id to the joined table so the factory won't be shown at the page.
the joined table looks like this:
bedrijfcategorieen
------------------
idbedrijfcat
idbedrijven
idcategorieen
Where idbedrijven is the id for my factories table.
My controller function for adding factories:
function bedrijven()
{
$data['options'] = $ddmenu;
$this->load->view('members/header');
$this->load->view('members/editform', $data);
$this->load->view('members/footer');
}
function addbedrijven()
{
$this->members_model->addbedrijf();
redirect('members/index');
}
my model function for adding factories:
function addbedrijf()
{
$data = array(
'idbedrijven' => $idbedrijven,
'Bedrijfsnaam' => $this->input->post('Bedrijfsnaam'),
'Postcode' => $this->input->post('Postcode'),
'Plaats' => $this->input->post('Plaats'),
'Telefoonnummer' => $this->input->post('Telefoonnummer'),
'Email' => $this->input->post('Email'),
'Website' => $this->input->post('Website'),
'Profiel' => $this->input->post('Profiel'),
'Adres' => $this->input->post('Adres'),
'logo' => $this->input->post('logo')
);
$this->db->insert('bedrijven', $data);
}
i would like to add my factories trough the joined table. so it would be easier to add categories to the factories too.
I tried where('bedrijfcategorieen.idbedrijven = idbedrijven
but it did not work.
table scheme
factories
---------
idfactories
factoryname
adress
postcode
country
telephone
...
...
categories
----------
idcategories
category
factorycategories
-----------------
idfactorycat
idfactories
idcategories