Can anyone explain to me why CakePHP wil only create one row when I execute the following code
$this->Adresses->save(array('Contact_ID' => $ClientID, 'Type' => 1, 'Addressline_1' => $_POST['Straat'], 'House_Number' => $_POST['Huisnummer'], 'Postal_Code' => $_POST['Postcode'], 'City' => $_POST['Woonplaats'], 'Country' => 'NL'));
$this->Adresses->save(array('Contact_ID' => $ClientID, 'Type' => 2, 'Addressline_1' => $_POST['F_Straat'], 'House_Number' => $_POST['F_Huisnummer'], 'Postal_Code' => $_POST['F_Postcode'], 'City' => $_POST['F_Woonplaats'], 'Country' => 'NL'));
I just want it to make 2 seperate rows in the same table
EDIT:
After I followed the solutions below and changed te code to this:
$this->Adresses->create();
$this->Adresses->save(array('Contact_ID' => $ClientID, 'Type' => 1, 'Addressline_1' => $_POST['Straat'], 'House_Number' => $_POST['Huisnummer'], 'Postal_Code' => $_POST['Postcode'], 'City' => $_POST['Woonplaats'], 'Country' => 'NL'));
$this->Adresses->create();
$this->Adresses->save(array('Contact_ID' => $ClientID, 'Type' => 2, 'Addressline_1' => $_POST['F_Straat'], 'House_Number' => $_POST['F_Huisnummer'], 'Postal_Code' => $_POST['F_Postcode'], 'City' => $_POST['F_Woonplaats'], 'Country' => 'NL'));
it saves to seperate rows but for some reason the column type is in both rows ‘1’. How is this possible?
You should call
createmethod after firstsavemethodeg :-