PHP / MYSQL从表中插入多行使用TRANSACTIONS的一个标准

I have to move several rows from one table to another one depending on a column value which is a number.

$order_code = '8888';
$conn->autocommit(false);

$sqlTranInsert = "SELECT * FROM shop_inventory WHERE item_order_code ='$order_code'";

if(!$resultTranInsert = $conn->query($sqlTranInsert)){
    echo 'Error '.$conn->error;
    $conn->close();
    exit;
}

while($row = $resultTranInsert->fetch_assoc()){
    $inve_id = $row['inve_id'];
    $sqlTranInsertItems = "INSERT INTO shop_inventory_archive SELECT * FROM shop_inventory WHERE inve_id = '$inve_id'";
    if(!$resultTranInsertItems = $conn->query($sqlTranInsertItems)){
        echo 'Error '.$conn->error;
        $conn->close();
        exit;
    }
}

$conn->commit();
$conn->close();
echo $msg;
exit;

My problem is that this is not working at all and I'm not sure about the WHILE loop and I'm sure that there is the problem. Thanks for any help.

Greetings.

We can copy all columns from one table to another, existing table:

INSERT INTO table2
SELECT * FROM table1;

Or we can copy only the columns we want to into another, existing table:

INSERT INTO table2
(column_name(s))
SELECT column_name(s)
FROM table1;