public function excluir($produtoId = null) { try { $delete = new Delete(); $delete->ExeDelete('produtos', "WHERE id = :id", "id={$produtoId}"); if (is_null($produtoId)) { throw new Exception('Digite um id para o produto', E_USER_ERROR); } else { if ($delete->getRowCount() < 1) { throw new Exception('Não existe um produto com esse ID!', E_USER_ERROR); } else { JBErro('<p>Produto deletado com Sucesso!</p>', JB_ACCEPT); } } } catch (Exception $e) { JBErro("<b>Erro ao Deletar:</b> {$e->getMessage()}", $e->getCode()); } }
<!DOCTYPE html> <html lang="pt-br"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php require './_app/Config.inc.php'; $delete = new Delete(); $delete->ExeDelete('ws_siteviews_agent', "where agent_id = :id", 'id=3'); if ($delete->getResult()) { echo "{$delete->getRowCount()} registro(s) removido(s) com sucesso!<hr>"; } // var_dump($delete); ?> </body> </html>