-
Notifications
You must be signed in to change notification settings - Fork 0
/
news-read.php
141 lines (89 loc) · 3.88 KB
/
news-read.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
session_start();
include('library/form/connection.php');
$db = new db();
$newsID = isset($_GET['id']) ? $_GET['id'] : '';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Coffeebreak Café International Inc. | News</title>
<!-- Bootstrap core CSS -->
<link href="library/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom fonts for this template -->
<link href="library/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Cabin:700' rel='stylesheet' type='text/css">
<!-- Custom styles for this template -->
<link href="css/grayscale.min.css" rel="stylesheet">
<link href="css/mystyles.css" rel="stylesheet">
<!-- Swiper Plug-in CSS -->
<link rel="stylesheet" href="css/swiper.min.css">
</head>
<body id="page-top">
<!-- Navbar Section -->
<?php include('library/html/navbar.php'); ?>
<!-- Menu Section -->
<section id="newsMain" class="newsMain-section">
<div class="container">
<div class = "row">
<div class = "col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div id = "newsDisplay"></div>
</div>
</div>
</section>
<!-- Footer Section -->
<?php include('library/html/footer.php'); ?>
<!-- Bootstrap core JavaScript -->
<script src="library/jquery/jquery.min.js"></script>
<script src="library/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Plugin JavaScript -->
<script src="library/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for this template -->
<script src="js/grayscale.min.js"></script>
<script src="js/mylibrary.js"></script>
<!-- Font Awesome CDN for mini icons-->
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
<!-- Swiper Plug-in -->
<script src="js/swiper.min.js"></script>
</body>
</html>
<script>
function addNewsDisplay(id,title, author, image, dateposted,content)
{
var content = '<p id = "newsDisplayTitle">' + title + '</p>'+
'<small>'+
'<i class="far fa-clock"></i> ' + dateposted + ' | '+
'<i class="fas fa-pencil-alt"></i> ' + author + '</small><br><br>'+
'<image id = "newsDisplayIMAGE" style = "padding-bottom: 25px;" class = "img-fluid" src = "img/news/' + image + '"></image>'+
'<div style = "text-indent: 60px;"><small>' + content + '</small></div>';
$("#newsDisplay").append(content);
}
<?php
$list_sql = $db->connection->prepare("SELECT article.ID, article.TITLE, article.CONTENT, article.IMAGE, article.DATEPOSTED, article.STATUS, CONCAT(account_user.FNAME, ' ', account_user.MNAME, ' ', account_user.LNAME) AS ACCOUNTNAME
FROM article
LEFT JOIN account_user
ON account_user.ID = article.POSTBY
WHERE article.ID =?");
$list_sql->bind_param("s", $newsID);
$list_sql->execute();
$list_sql->bind_result($id,$title,$content,$image,$dateposted,$status,$accountname);
// $list_count = mysqli_num_rows($list_result);
while($list_row = $list_sql ->fetch())
{
$result_ID = $id;
$result_TITLE = $title;
$result_IMAGE = $image;
$result_DATEPOSTED = $dateposted;
$result_POSTBY = $accountname;
$result_CONTENT = $content;
?>
addNewsDisplay("<?php echo $result_ID; ?>","<?php echo $result_TITLE; ?>","<?php echo $result_POSTBY; ?>","<?php echo $result_IMAGE; ?>","<?php echo $result_DATEPOSTED; ?>","<?php echo $result_CONTENT; ?>");
<?php
}
?>
</script>