I'm starting my studies in PHP. I need to make a logical exclusion and although I have already found enough content on the topic, I can not find exactly how to do logical exclusion in PHP. Mine I did so (physical):
function remove( $table = null, $id = null ) {
$database = open_database();
try {
if ($id) {
$sql = "DELETE FROM " . $table . " WHERE id = " . $id;
$result = $database->query($sql);
if ($result = $database->query($sql)) {
$_SESSION['message'] = "Registro Removido com Sucesso.";
$_SESSION['type'] = 'success';
}
}
} catch (Exception $e) {
$_SESSION['message'] = $e->GetMessage();
$_SESSION['type'] = 'danger';
}
So far I understand that I need to put the deletion date and just edit rather than delete, but I did not really understand how it works. Could anyone help me?