I am trying to move all data from one table to another and that bit on it's own works fine, the part I am having trouble with is then deleting the data from the old table. The MYSQL query I hvae put together runs fine as an SQL query on PHPMyAdmin but for some reason gives me an error about syntax at line 2 if i run it from my webpage. Please see below for the query from the website.
if($old == 'Yesterday'){
$movequery = "INSERT INTO yesthistory select * from history;
TRUNCATE TABLE history";
if (!mysqli_query($con2, $movequery))
{
echo("Error description: " . mysqli_error($con2));
}