Trying to update multiple results in 1 database column first need to get previous values than update with new so far i wrote this query but it's not working see code query & current results
Code
<?php
include( $_SERVER['DOCUMENT_ROOT'] . '/config.php' ); $mysqli = $link;
$user_pages = mysqli_query($mysqli,"SELECT actual_grand_total FROM user_pages");
$actual_grand_total = $user_pages/100;
$query1 = mysqli_query($mysqli,"update user_pages set actual_grand_total=($actual_grand_total)");
$user_pages = mysqli_query($mysqli,"SELECT grand_total FROM user_pages");
$grand_total = $user_pages/100;
$query2 = mysqli_query($mysqli,"update user_pages set grand_total=($grand_total)");
?>
database table "user_pages"
actual_grand_total | grand_total
------------------ -----------
1000 750
5000 500
7500 750
I am getting those wrong results
actual_grand_total | grand_total
------------------ -----------
1.000 1.000
1.000 1.000
1.000 1.000
expected results
actual_grand_total | grand_total
------------------ -----------
10 7.5
50 5
75 7.5
can someone correct me ... i want to update current results dividing by 100