I have a CMS dashboard that lists all current and old news.
I have links that let me EDIT and DELETE any story by taking me to another page.
What I need now is a third link to ARCHIVE STORY that simply lets me move a current news story into the old news table without leaving the page, but I don't know A) how to code the anchor tag for this, or B) if there is MOVE sql statement or if it's simply INSERT and then DELETE.
Here is code that works from my DELETE page.
Code: Select all
$stmt = $conn->stmt_init();
if ($stmt->prepare($sql)) {
// bind the query parameters
$stmt->bind_param('i', $_GET['storyID']);
// bind the result to variables
$stmt->bind_result($storyID, $headline, $created);
// execute the query, and fetch the result
$OK = $stmt->execute();
$stmt->fetch();
}
}
// if confirm deletion button has been clicked, delete record
if (array_key_exists('delete', $_POST)) {
$sql = 'DELETE FROM news WHERE storyID = ?';
$stmt = $conn->stmt_init();
if ($stmt->prepare($sql)) {
$stmt->bind_param('i', $_POST['storyID']);
$deleted = $stmt->execute();
}
}Code: Select all
<td><a href="updateNews.php?storyID=<?php echo $row['storyID']; ?>">EDIT</a></td>
<td><a href="deleteNews.php?storyID=<?php echo $row['storyID']; ?>">DELETE</a></td>
<td><a click here to>MOVE TO ARCHIVES</a></td>Arlen