0

I have the same problem of this Zend_Db_Table: Delete multiple entries, but the code of fireeyedboy sames to not working. I haven't errors but the db entries still exist. What can i do? My code in the model is identically in effect:

public function deleteUsers($usernames) //elimina più utenti passati con una stringa
{
    $where = array();
    foreach ($usernames as $username) {
    $where[] = $this->getAdapter()->quoteInto('username IN (?)', $username);
    }

    $this->delete($where);
}

Where $usernames is an array dinamically created by a multicheckbox selection. I assign the parameters to this array in this way in my controller:

$list=$this->getRequest()->getParam('utenti');
$this->_adminModel->deleteUsers($list);
$this->_redirector->gotoSimple('success',
                               'admin',
                                null);

For same reason my code go to the successAction but it not do the deleting.

Community
  • 1
  • 1
bany
  • 7
  • 4

1 Answers1

0

Omit foreach loop. If $usernames is array of usernames, your deleteUsers method should look like this:

public function deleteUsers($usernames)
{
    $where = $this->getAdapter()->quoteInto('username IN (?)', $usernames);
    $this->delete($where);
}

If not, please post output of var_dump($usernames).

Daniel Gadawski
  • 1,893
  • 4
  • 20
  • 32