i want to transfer data from column to another table column using PHP for example table1 has a column "amount" and table 2 column "total". how can i transfer/copy the value in "amount" to "total"?
sory for my bad english
edit: i use MySql db
i want to transfer data from column to another table column using PHP for example table1 has a column "amount" and table 2 column "total". how can i transfer/copy the value in "amount" to "total"?
sory for my bad english
edit: i use MySql db
You can simple use below query if you are looking to update MySQL table from PHP.
UPDATE `table` SET amount=total;
$update = mysqli_query('your_connection', 'UPDATE $tablename SET column1 = '$value1', column2 = '$value2' WHERE Condition');
For details: http://dev.mysql.com/doc/refman/5.7/en/update.html
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);