将数据复制到另一个表,然后从原始表中删除复制的数据

时间:2019-05-12 03:43:04

标签: php mysqli

删除成功,但是将其复制到其他数据库表失败。 它不会显示任何错误。我在这里提供了我的SQL。

$temp1= $_POST["optemployee"];
$sql="SELECT * FROM employees";
$query = $conn->query($sql);
$row = $query->fetch_assoc();
$sqlins="INSERT INTO employeearchive (employee_id, firstname, lastname, emppassword, address, birthdate, contact_info, gender, position_id, schedule_id, photo, photopath, created_on)
                              VALUES (".$row['employee_id'].", ".$row['firstname'].", ".$row['lastname'].", ".$row['emppassword'].", ".$row['address'].", ".$row['birthdate'].", ".$row['contact_info'].", ".$row['gender'].", ".$row['position_id'].", ".$row['schedule_id'].", ".$row['photo'].", ".$row['photopath'].", ".$row['created_on'].")";
$queryins = $conn->query($sqlins);
$sqldel="DELETE FROM employees WHERE firstname = '$temp1'";
mysqli_query($conn,$sqldel);
mysqli_close($conn);

0 个答案:

没有答案