XF 2.2 Issue with deleting a row

grantus

Active member
I'm trying to delete a row:

Code:
private static function deletePending($table, $upload_id) {

    $db = \XF::db();

    $rowsDeleted = $db->delete($table, [
         'upload_id' => $upload_id
     ]);

}

And I'm calling it in another method like this:

Code:
self::deletePending('xf_ill_bfights_uploads', $row['upload_id']);

But I'm getting this error:

Code:
ErrorException: [E_WARNING] Array to string conversion

It keeps pointing to this line:

Code:
 'upload_id' => $upload_id

The upload_id column is an integer, of course, but I got the same error even when testing on a string column.

Why do I keep getting the array to string error?
 
The second argument to \XF\Db\AbstractAdapter::delete is a condition string, not an array:

PHP:
\XF::db()->delete($table, 'upload_id = ?', $upload_id);
 
Back
Top Bottom