the Code is supposed to update the score only if there is no score with the same email greater than the current score, instead it displays the error:
Error: Error: ER_BAD_FIELD_ERROR: Unknown column 'li' in 'where clause'
function postScores(useremail, username, scoreValue, leaderboardName) {
if (leaderboardName === "GHOSTS" || leaderboardName === "PACMAN" || leaderboardName === "OVERALL") {
connection.query('UPDATE SCORES_' + leaderboardName + ' SET SCORES=' + scoreValue + ' WHERE SCORES < ' + scoreValue + ' AND USER_EMAIL=' + useremail,
function(err, rows, fields) {
if (err) {
console.log("Failed to Update. Attempting to Insert.");
console.log("Error: " + err);
connection.query(
'INSERT INTO SCORES_' + leaderboardName + '(USER_EMAIL, USER_NAME, SCORES) VALUES (?,?,?)', [
useremail, username, scoreValue
],
function(err, rows, fields) {
if (err) {
console.log("Total Failure. Systems down");
} else {
console.log("Success. Inserted new Scores");
}
});
}
});
} else {
// Reference to Non-Existent Leaderboard
return console.log('Specified Leaderboard of the name ' + leaderboardName + ' does not Exist');
}
}