php function deleteNews id sql DELETE FROM msgs WHERE id id result thi

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
function deleteNews($id){
$sql = "DELETE FROM msgs WHERE id=$id";
$result = $this->_db->exec($sql);
if (!empty($result)) {
return $result;
} else {
$errMsg[] = 'Произошла ошибка при удалении новости';
}
}
if (!empty($_GET["del"])) {
include "delete_news.inc.php";
}
$del = (int)$_GET["del"];
if (is_int($del)) {
$news->deleteNews($del);
header("Location: news.php");
}else{
$errMsg[] = 'Хакер, не ломай мою новостную ленту!';
}
?>