public function task_delete() { global $dbh; $id = isset($_GET['id']) ? (int) $_GET['id'] : null; if (!$id) { SB_MessagesStack::AddMessage('Identificador de imagen invalido.', 'error'); return false; } $query = "DELETE FROM contenido WHERE id = {$id} LIMIT 1"; $dbh->query($query); SB_MessagesStack::AddMessage('Imagen borrada', 'success'); header('Location: index.php?mod=images'); }
public function task_delete() { global $dbh; $video_id = isset($_GET['id']) ? (int) $_GET['id'] : null; if (!$video_id) { return false; } $query = "SELECT * FROM contenido WHERe id = {$video_id} LIMIT 1"; $row = $dbh->query($query)->fetch_object(); //##delete image if (!empty($row->imagen)) { @unlink(BASEPATH . '/imagen/archivos/' . $row->imagen); } $query = "DELETE FROM contenido WHERE id = {$video_id} LIMIT 1"; $dbh->query($query); SB_MessagesStack::AddMessage('El video fue borrado.', 'success'); header('Location: index.php?mod=videos'); }