0

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?

1 Answer 1

1

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);
Sign up to request clarification or add additional context in comments.

1 Comment

i've used the second option and it works... Thank's a lot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.