0) { $row = mysqli_fetch_assoc($result); $userBalance = $row['balance']; } else { $userBalance = 0; } $betPlaced = 10; $isWin = true; if (isset($_POST['play_game'])) { $winAmount = $_POST["money"]; print($winAmount); if ($isWin) { $userBalance += $winAmount; } else { $userBalance -= $betPlaced; if ($userBalance < 0) { $userBalance = 0; } } $updateQuery = "UPDATE users SET balance = '50' WHERE id = 5"; $updateResult = mysqli_query($conn, $updateQuery); if ($updateResult) { print "Balance updated successfully"; } else { print "Error updating balance: " . mysqli_error($conn); mysqli_commit($conn); } if ($updateResult) { $_SESSION['user_balance'] = $userBalance; } else { echo "Update Balance Failed: " . mysqli_error($conn); // Hata durumunda yapılacak işlemler } } // Diğer kod blokları } else { $betPlaced = 10; $isWin = true; if (isset($_POST['play_game'])) { $winAmount = $_POST["money"]; print($winAmount); if ($isWin) { $userBalance += $winAmount; } else { $userBalance -= $betPlaced; if ($userBalance < 0) { $userBalance = 0; } } $updateQuery = "UPDATE users SET balance = $userBalance WHERE id = 5"; $updateResult = mysqli_query($conn, $updateQuery); if ($updateResult) { print "Balance updated successfully"; } else { print "Error updating balance: " . mysqli_error($conn); mysqli_commit($conn); } if ($updateResult) { $_SESSION['user_balance'] = $userBalance; } else { echo "Update Balance Failed: " . mysqli_error($conn); // Hata durumunda yapılacak işlemler } } } ?>
test 1
Please rotate your device