Use this. here I use userId to select a particular row. you can alter it or not use it according to your requirement.
$query = "SELECT amount FROM table1 WHERE userId='{$id}'";
$result = mysqli_query($con,$query);
$sql = "UPDATE table2 SET total="{$result}" WHERE userId='{$id}'";
mysqli_query($con,$sql);
0
solved i want to transfer data from column to another table column using PHP [duplicate]