In below image , Once we click on " submit " button in third column , I want to copy the tracking id from Table 2's column to Table 1's column ....
Table orders
displayed tracking id" in 4th column
I saved order information in table orders [ Table 1 ]
I saved tracking ids in table awbno [ Table 2 ] & in column tracking_two
track.php
<?php
$con = mysqli_connect("localhost","root","","do_management4");
$result = mysqli_query($con,"SELECT * FROM orders");
echo "<table border='1'>
<tr>
<th>order</th>
<th>payment</th>
<th>generate</th>
<th>tracking id</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
$id = $row['id'];
echo "<tr>";
echo "<td>" . $row['order_id'] . "</td>";
echo "<td>" . $row['payment_type'] . "</td>";
echo "<td>";
if (empty($row['tracking_one'])) {
echo "<form method='post' action='call.php'>";
echo "<input type ='hidden' name='id' value='$id'>
<input type='submit'>
</form>";
}
echo "</td>";
echo "<td>" . $row['tracking_one'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
call.php
<?php
$con = mysqli_connect("localhost","root","","do_management4");
$result = mysqli_query($con,"SELECT * FROM orders");
$id = $_POST['id'];
$r = "";
$sql = $con->query("update orders set tracking_one = '$r' WHERE id ='$id'");
mysqli_close($con);
?>
I did't found any particular query in google, What query will help me ?
您的查询应该是这样的
$sql = $con->query("update orders set tracking_one = (select tracking_two from awbno WHERE id =$id)");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.