-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdelete.php
More file actions
30 lines (30 loc) · 744 Bytes
/
delete.php
File metadata and controls
30 lines (30 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<html>
<head>
<title>Delete</title>
<script type="text/javascript">
function check(id){
if (confirm("Are you sure you want to delete this news item?"))
this.location.href = "?id="+id;
}</script>
</head>
<body>
<?php
//$_GET['id']=false;
error_reporting(E_ALL ^ E_DEPRECATED);
mysql_connect('localhost','root','');
mysql_select_db('sms');
if(!isset($_GET['id']) && empty($_GET['id']))
{
$query = mysql_query('SELECT * FROM news ORDER BY id DESC');
while($result = mysql_fetch_assoc($query))
echo $result['subject'].' » <a href="#" onclick="check('.$result['id'].'); return false;">Delete</a><br />';
}
else
{
$id = $_GET['id'];
mysql_query("DELETE FROM news WHERE id = $id LIMIT 1");
echo 'News Deleted.';
}
?>
</body>
</html>