-
Notifications
You must be signed in to change notification settings - Fork 0
/
story_admin.php
78 lines (71 loc) · 2.42 KB
/
story_admin.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
<?php
ob_start();
$title = 'Story Admin';
require 'includes/head.php';
require 'includes/nav.php';
require 'includes/utilities.php';
require 'includes/data_connection.php';
if (isset($_SESSION['f_name'])) {
}
else {
ob_clean();
header("Location: index.php");
}
?>
<!-- ********** Story Admin ********** -->
<header>
<h1>Story Admin</h1>
</header>
<nav>
<ul>
<li><a href="user_admin.php">User Admin</a></li>
<li><a href="product_admin.php">Product Admin</a></li>
<li><a href="story_admin.php">Story Admin</a></li>
<li><a href="comment_admin.php">Comment Admin</a></li>
</ul>
</nav>
<main class="container">
<div class="row">
<div class="col-12">
<table>
<tr>
<td>Story ID</td>
<td>Headline</td>
<td>Byline</td>
<td>Text</td>
<td>Pub Date</td>
<td>View</td>
<td>Edit</td>
<td>Delete</td>
</tr>
<?php
$sql = "SELECT * FROM stories";
//echo $sql;
$result = $db->query($sql);
/*if($db_connect_error){
$data_error=$db->connect_error;
}
else{
echo "Data Retrieving";
}*/
while(list($story_id, $headline, $byline, $text, $pub_date)=$result->fetch_row()){
echo "<tr>";
echo "<td>$story_id</td>";
echo "<td><a href='news_detail.php?story_id=$story_id'>$headline</a></td>";
echo "<td>$byline</td>";
echo "<td>".(substr($text,0,76))."</td>";
$date = date_create($pub_date);
$formatted_date = date_format($date, 'F d, Y');
echo "<td>$formatted_date</td>";
echo "<td><a href='news_detail.php?story_id=$story_id'>View</a></td>";
echo "<td><a href='story_edit.php?story_id=$story_id'>Edit</a></td>";
echo "<td><a href='story_delete.php?story_id=$story_id'>Delete</a></td>";
echo"</tr>";
}
?>
</table>
<br><br>
<a href="story_new.php">Add New Story</a>
</div>
</div>
</main>