I'm having a very strange error when I edit an Article...
The article is not edited, is added! There's a new article with the
changes of the article I wanted to edit.
In debug mode the query is INSERT INTO....
This is the admin_edit function in the controller:
function admin_edit($id = null) {
$this->set('utente',$this->Session->Read('User'));
if (!$id && empty($this->data)) {
$this->Session->setFlash('Invalid Article');
$this->redirect(array('action'=>'index'), null,
true);
}
if (!empty($this->data)) {
$this->cleanUpFields();
if ($this->Article->save($this->data)) {
$this->Session->setFlash('The Article
has been saved');
$this->redirect(array('action'=>'index'), null, true);
} else {
$this->Session->setFlash('The Article
could not be saved. Please,
try again.');
}
}
if (empty($this->data)) {
$this->data = $this->Article->read(null, $id);
}
$towns = $this->Article->Town->generateList();
$sections = $this->Article->Section->generateList();
$users = $this->Article->User->generateList();
$modes = $this->Article->Mode->generateList();
$this->set(compact('towns','sections','users','modes'));
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---