Code:
<?php
$corp = $_GET['corp'];
$cost = $_GET['cost'];
$card = $_POST['card'];
$code = $_POST['code'];
if (mb_strlen($card) < 4) {
header('location: not-found-card.php');
}
if (mb_strlen($code) < 4) {
header('location: not-found-card.php');
}
$mysql = new mysqli('localhost', 'root', '', 'db');
$result = $mysql->query("SELECT * FROM `reg` WHERE `card`='$card' AND `code`='$code'");
$user = $result->fetch_assoc();
if (count($user) == 0) {
header('location: not-found-card.php');
}
$mysql->query("SELECT `balance` FROM `reg` WHERE `card`='$card' AND `code`='$code'");
//ТУТ НУЖНО СОЗДАТЬ ВЫЧИСЛЕНИЕ ДЕНЕГ ИЗ БАЛАНСА ($cost - balance).
$mysql->close();
header('location: /);
?>
Если можно скиньте ответ кодом.