你好我试图从工作表中减去接受的出价是一个int,并从客户表中减去信用,但由于某种原因,它将信用行更新为-21而不是78,因为接受的出价是= 22。任何想法为什么会这样?
<?php
session_start();
require 'config.php';
$id = $_SESSION['login_user'];
$jobid = $_POST['job_id'];
$poster_id = $_POST['poster_id'];
$accepted_bidder = $_POST['accepted_bidder'];
$accepted_bid = (int) $_POST['accepted_bid'];
$query = "SELECT credit FROM `customer` WHERE email_adress = '$id'";
$result = $conn->query($query);
//echo $result;
//echo $accepted_bid;
$updated_credit = (int)$result- $accepted_bid;
//echo $updated_credit;
$query2 = "UPDATE job SET start_escrow = '1' WHERE job_id = '$jobid'";
$success = $conn->query($query2);
$query3 = " UPDATE customer SET credit = '$updated_credit' WHERE email_adress = '$id'";
$success3 = $conn->query($query3);
$poster_id = $_POST['poster_id'];
if (!$success) {
die("Couldn't enter data: ".$conn->error);
}
header("location: myjobs.php");
echo "Thank You For Contacting Us <br>";
$conn->close();
?>
答案 0 :(得分:2)
基本PHP错误:
您在行尾
缺少最终;
$updated_credit = (int)$result- $accepted_bid
......应该是
$updated_credit = (int)$result- $accepted_bid;