-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdisplay.php
More file actions
58 lines (46 loc) · 1.06 KB
/
display.php
File metadata and controls
58 lines (46 loc) · 1.06 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<html>
<head>
<title>News</title>
</head>
<body style="background-color:khaki;">
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
mysql_connect('localhost','root','');
mysql_select_db('sms');
//echo 'SELECT * FROM news ORDER BY id DESC limit 3';
if(isset($_POST['all'])){
$query = mysql_query('SELECT * FROM news ORDER BY id DESC');
}
else{
$query = mysql_query('SELECT * FROM news ORDER BY id DESC limit 3');
}
while($result = mysql_fetch_assoc($query))
{
echo $result['subject'].'<br />';
echo $result['news'].'<br / >';
echo 'Date:'. $result['date'].'<br / >';
echo 'Posted by '.$result['postedby'];
echo '<hr />';
}
if(!isset($_POST['all'])){
?>
<div >
<form action="display.php" method='post'>
<input type="submit" name="all" value="View All" />
</form>
<div >
<?php
}
else{ ?>
<div >
<form action="login.php" method='post'>
<input type="submit" name="back" value="Back" />
</form>
<div >
<?php } ?>
<!--<form action="<?php //echo $_SERVER["PHP_SELF"];?>" method='post'>
<input type="submit" name="previous" value="Prev" />
</form>-->
</div>
</body>
</html>