Ama kullanıcının hesabına girilen miktarın 2 katını iade ediyor. gelen miktarlar doğru değişkenleri kontrol ettim bir sorun yok.
başlangıç bölümü
$shooting = $baglanti->query("SELECT * FROM orders where status IN ('Processing','Pending', 'In progress') ORDER BY start_count ASC", PDO::FETCH_ASSOC );
foreach ($shooting as $key)
{
$price = $key['price'];
$quantity = $key["quantity"];
.
.
.
if ( $api_option == "instasepeti" ){
$api = new Api();
$api->api_url = $api_detail_url;
$api->api_key = $api_detail_key;
$result = $api->status("$order_id");
$remains = $result->remains;
$start_count = $result->start_count;
if ($result->status == "Processing") {
$status_edit = "İşlemde";
}elseif ($result->status == "Pending") {
$status_edit = "Bekliyor";
}
.
.
.
if ($result->status == 'Completed' || $result->status == 'Partial' || $result->status == 'Canceled' ) {
$b= $price / $quantity;
$balance = ($b* $remains);
$new_price = $price - $balance;
$baglanti->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sth = $baglanti->exec("UPDATE orders SET price = $new_price, start_count = $start_count, remains = $remains, status = '$status_edit' WHERE id = $id ");
$sth2 = $baglanti->exec("UPDATE user SET balance = balance + $balance WHERE user_name = '$user_name' ");
}sorun devam ediyor