我正在尝试将记录从表格studentrecords
移至passivestudents
,但我无法将其记录下来。到目前为止,我已经尝试过了。
<?php
$db = new mysqli("localhost", "root", "","learndb");
if ($db->connect_error) {
die("Connection failed this is the error: " . $db->connect_error);
}
$id=$_GET['id'];
$sql="INSERT INTO passivestudents VALUES (DELETE FROM studentrecords WHERE id=$id)";
$result=$db->query($sql);
if(!$result)
{
echo"ERROR MOVING";
}
else
{
echo "<center><p style=\"color:green\">Information Moved!</p></center>";
}
?>
答案 0 :(得分:0)
你的查询错了。你想删除有一些身份证的学生?是吗?
请按照以下步骤操作:
1 - INSERT INTO your_sec_table (select * from first_Table where id= $id;
2 - DELETE FROM first_table WHERE id=$id