Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('connect.php');
- include('header.php');
- // If the delete button is pressed
- if ( $_GET['action'] == 'delete' ) {
- // Check if a post id is set
- // It says: If post_id is something different than empty, move on..
- if ( $_GET['post_id'] != '' ) {
- mysql_query ("DELETE FROM blogg_table WHERE id = '" . $_GET['post_id'] . "'");
- }
- }
- ?>
- <br />
- <h1><i>Administration site</i></h1>
- <?php
- // Administrate the blog posts
- $result = mysql_query("SELECT * FROM blogg_table ORDER BY date DESC");
- while($row = mysql_fetch_assoc($result)){
- echo '<div class="post">';
- echo '<a href="admin.php?action=delete&post_id=' . $row['id'] . '">Slett</a>';
- echo '<h2>' . $row['header'] . '</h2>';
- echo '<h3>' . date ('d. m Y', $row['date']) . '</h3>';
- //echo '<p>' . htmlspecialchars ($row['text']) . '</p>';
- echo '<br />';
- echo '<br />';
- echo '</div>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement