[eluser]toopay[/eluser]
Code:
function createaddress ($town, $street, $CP, $PSC)
{
$data = array (
'Mesto' => $town,
'Ulice' => $street,
'CP' => $CP,
'PSC' => $PSC
);
$this->db->insert('adresa', $data);
return $this->db->insert_id();
}
function createcustomer ($phone, $email, $name, $surname, $address_id)
{
$data = array (
'Telefon' => $phone,
'Email' => $email,
'Jmeno' => $name,
'Prijmeni' => $surname,
'adresaID' => $address_id
);
$this->db->insert('zakaznik', $data);
}
And in controller:
Code:
$address_id = $this->data_model->createaddress($this->input->post('Town'), $this->input->post('Street'), $this->input->post('StreetN'), $this->input->post('ZIP'));
$this->data_model->createcustomer($this->input->post('Phone'), $this->input->post('Email'), $this->input->post('FirstN'), $this->input->post('SecondN'),$address_id);