1
幫助。我怎麼能移動或從一個表中移動一行到另一個mysql表中?一旦我點擊「批准」,選定的行將轉移到數據庫中的另一個表格。請檢查我的代碼。謝謝!如何將一行從一個表移動到另一個表中的mysql?
message.php
<?php
include('connect.php');
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM message");
while($row = mysqli_fetch_array($result))
{
echo '<tr class="record">';
echo '<td style="background-color: #F8F8F8 ;font-size: 13px; color: maroon;
font-weight: bold; border-left: 1px solid #C1DAD7;">'.$row['name'].'</td>';
echo '<td><div style="font-size: 13px;" align="left">'.$row['address'].'</div></td>';
echo '<td><div style="color:maroon; font-size: 13px;"align="left">Email:<br></div>
<div style="font-size: 13px;"align="left">'.$row['email'].'</div><br>
<div style="font-size: 13px; color:maroon;"align="left">Contact No.<br></div>
<div style="font-size: 13px;"align="left">'.$row['number'].'</div></td>';
echo '<td><div style="font-size: 13px;"align="left">'.$row['services'].'</div></td>';
echo '<td><div style="color:maroon; font-size: 13px;"align="left">Desired Date:<br></div>
<div style="font-size: 13px;"align="left">'.$row['shootdate'].'</div><br>
<div style="font-size: 13px; color:maroon;"align="left">Desired Time: <br></div>
<div style="font-size: 13px;"align="left">'.$row['shoottime'].'</div></td>';
echo '<td><div style="font-size: 13px;"align="left">'.$row['place'].'</div></td>';
echo '<td><div style="font-size: 13px;"align="left">'.$row['message'].'</div></td>';
echo '<td><div align="center">
<a href="acceptmessage.php" id="'.$row['message_id'].'" class="acceptbutton"
title="Click To Approve">Approve</a><br><br>
<a href="deletemessage.php" id="'.$row['message_id'].'" class="delbutton"
title="Click To Decline" style="color:red;">Decline</a></div></td>';
echo '</tr>';
}
?>
acceptmessage.php
<?php
include('../db.php');
if($_GET['id']){
$id = (isset($_GET['id']) ? $_GET['id'] : null);
$sql = "INSERT INTO accept (name, address, email, number, services, shootdate, shoottime, place) SELECT name, address, email, number, services, shootdate, shoottime, place FROM message WHERE message_id='$id'";
mysqli_query($GLOBALS["___mysqli_ston"], $sql);}
?>
你有錯誤? .. – scaisEdge