I am new to PHP, so please bear with me. I set up Xampp since I'm working on a project to create a CSRF vulnerable site. This will simulate a bank transfer that is vulnerable to it. I need to create a php page for the transfer. I already have the code mapped out, since it's a nearly ended project. I populated the database and made sure everything was fine in that part. But there seems to be some kind of a problem, as instead of adding to the value of the transfer, to the receiver , the database gets changed to the exact same value +1 for some reason. And I cannot figure this out.
$target = $_GET['TransferTarget'];
$amount = $_GET['TransferAmount'];
$target_query = "SELECT * FROM accounts acc WHERE (acc.AccountNumber = '$target')";
$target_result = mysqli_query($connection, $target_query);
$target_balance = mysqli_data_seek($target_result, 0);
$target_balance = $target_balance + $amount;
$source_balance = $source_balance - $amount;
$update_target_query = "UPDATE accounts SET accounts.Amount = '$target_balance' WHERE accounts.AccountNumber = '$target'";
$update_source_query = "UPDATE accounts SET accounts.Amount = '$source_balance' WHERE accounts.AccountNumber = '$source_account'";
$update_target_result = mysqli_query($connection, $update_target_query);
$update_source_result = mysqli_query($connection, $update_source_query);
Desired outcome would be for example if I transferred 100 dollars to an acc that already had 1000, to be 1100. The result I get for the same example, is 101 dollars in the end account. So, the targets account gets updated to 101 dollars. I can't seem to understand why this happens.