仅当提交的分数高于现有分数时才更新mysql数据库的分数

I use the following PHP to update the score for a particular quiz number where the username is equal to the current session username. Quiz number and score come from javascript via an ajax function.

$score = mysqli_real_escape_string($con, $_POST['score']);

$QuizNumber = mysqli_real_escape_string($con, $_POST['QuizNumber'])

$sql="UPDATE users

SET $QuizNumber='$score'

WHERE username='".$_SESSION['MM_Username']."'";

This works fine, however I am trying to include a conditional statement that only updates the score if the existing score on the database is less than the score being submitted.

This is the statement I have tried including but with no success:

if (['QuizNumber'] < $_POST['score'])

How do I get $QuizNumber to be set equal to submitted score only when it is higher than the existing database score?

Thanks in advance for any help!

How about the following:

$score = mysqli_real_escape_string($con, $_POST['score']);
$QuizNumber = mysqli_real_escape_string($con, $_POST['QuizNumber'])

$sql="UPDATE users
SET $QuizNumber = '$score'
WHERE username = '".$_SESSION['MM_Username']."'
AND $QuizNumber < '$score'";