-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
75 lines (63 loc) · 1.63 KB
/
index.php
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php include("db.php"); ?>
<!doctype html>
<html>
<head>
<title>
News Page with simple CMS
</title>
<link rel="stylesheet" href="reset.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Varela+Round">
</head>
<body>
<div id="header">
<h1>
News Page - simple CMS
</h1>
</div>
<fieldset>
<?php
$query=mysql_query("SELECT * FROM $tbl_name WHERE id='1'");
$numrows=mysql_num_rows($query);
while($row=mysql_fetch_assoc($query)){
$title1=$row['title'];
$text1=$row['news'];
}
$query2=mysql_query("SELECT * FROM $tbl_name WHERE id='2'");
$numrows2=mysql_num_rows($query2);
while($row=mysql_fetch_assoc($query2)){
$title2=$row['title'];
$text2=$row['news'];
}
$query3=mysql_query("SELECT * FROM $tbl_name WHERE id='3'");
$numrows3=mysql_num_rows($query3);
while($row=mysql_fetch_assoc($query3)){
$title3=$row['title'];
$text3=$row['news'];
}
$amount=mysql_query("SELECT COUNT(*) FROM $tbl_name");
$amount=$amount-3;
for($i="1"; $i<"$amount"; $i++){
${'query'."$i"}=mysql_query('SELECT * FROM $tbl_name WHERE id="$i"');
${'numrows'."$i"}=mysql_num_rows(${'query'."$i"});
if($row=mysql_fetch_assoc(${'query'."$i"})){
${'title'."$i"}=$row['title'];
${'text'."$i"}=$row['news'];
}
Echo "
<h2>
${'title'."$i"}
</h2>
<p>
${'text'."$i"}
</p>
<hr>
";
}
?>
</fieldset>
<div id="footer">
<a href="cms.php">UPLOAD NEWS</a>
</div>
</body>
</html>