谁能向我解释为什么当我执行以下代码时 CakePHP 只会创建一行
$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'));
我只希望它在同一个表中创建 2 个单独的行
编辑:
在我遵循以下解决方案并将代码更改为此之后:
$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'));
它保存到单独的行,但由于某种原因,列类型在两行“1”中。这怎么可能?