gpt4 book ai didi

PHP 表单更新 MYSQL 行

转载 作者:行者123 更新时间:2023-11-28 23:27:20 26 4
gpt4 key购买 nike

<分区>

我有一个更新 MySQL 数据库的 PHP 表单。我想将学分添加到行中的当前学分。基础数学

当前积分 50 再加上 50 积分 = 100

这是我当前的字符串(已编辑)

    $sql = sprintf("UPDATE h_clients ". "SET credits = $credits + '%s'" . "WHERE id = $id",

Currently this works but it doesn't add the new credits with the current credits in DB

Here is the full code:

$sql = sprintf("UPDATE h_clients ". "SET credits = $credits + '%s'" . "WHERE id = $id",

mysql_real_escape_string($credit),
mysql_real_escape_string($id));

if (mysql_query($sql, $con)) {
$insertSuccessful = true;
} else {
echo $sql;
echo "\n" . mysql_error($con);
echo "mysql err no : " . mysql_errno($con);
}
}

}

return $insertSuccessful;

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com