I am trying to move a field from one table to another and then delete it from the first table. The problem I am having is that it moves the data fine, but it is not deleting it from the first table.
Here is my code:
"INSERT INTO out_tickets SELECT * FROM tickets";
"DELETE FROM tickets WHERE * FROM tickets";
Not sure what I am doing wrong?
EDIT
Updated Code:
<?php
// Process delete operation after confirmation
if(isset($_POST["id"]) && !empty($_POST["id"])){
// Include config file
require_once 'config.php';
// Prepare a select statement
$sql = "INSERT INTO out_tickets SELECT * FROM tickets";
"DELETE FROM tickets";
if($stmt = mysqli_prepare($link, $sql)){
// Bind variables to the prepared statement as parameters
mysqli_stmt_bind_param($stmt, "i", $param_id);
// Set parameters
$param_id = trim($_POST["id"]);
// Attempt to execute the prepared statement
if(mysqli_stmt_execute($stmt)){
// Records deleted successfully. Redirect to landing page
header("location: technical.php");
exit();
} else{
echo "Oops! Something went wrong. Please try again later.";
}
}