我在这里有一个查询,它将 +1 添加到现有字段。但是我不知道如何使用准备好的语句来做到这一点。所以在这里我将 +1 添加到现有号码。除了“+1”部分,我知道怎么做。
$updateUsers = mysqli_query($MySQLi, "UPDATE `users` SET ArticlesWritten=ArticlesWritten +1 WHERE uUsername='{$_GET['uUsername']}'");
$query = "UPDATE `table` SET `column`=`column`+1 WHERE `primary_key`=?";
$execute = $db->prepare($query);
if($execute) {
$execute->bind_param('i', $primary_value);
$execute->execute();
} else {
echo 'We\'re having trouble connecting to the database at the moment, try again later!';
}