Edoardo
Edoardo

Reputation: 619

Mysql delete query using zend

i'm developing an application where there is a function (correctly called) that receive an id an should delete records from a table where the id is present.

This is my code:

public function deleteAction($id) {
        if ($id) {
            $where[] = $this->_db->quoteInto('transazione = ?', $id);
            $this->_db->delete($this->_name, $where);   
        }
    }

The function is correctly called but i receive this error:

An error occurred

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1

How can i solve this?

Upvotes: 0

Views: 2799

Answers (1)

bxN5
bxN5

Reputation: 1430

try

   $n = $this->_db->delete('tablename', "column_id = $id");
        /*or*/ 
   $q = $this->_db->quoteInto('DELETE * FROM bugs WHERE reported_by = ?', $id);
   $this->_db->query($q);

Upvotes: 1

Related Questions