Is it possible to update a SQL column without actually defining the specific name in the query, but rather using a variable passed through function arguments?
Example
public function ScrubUserContent($db, $DBColunm, $UID, $type) {
if($type == 1){
mysqli_query($db, "UPDATE Users SET $DBColunm = '[ Content Deleted ]' WHERE UserID='$UID'"); // Type 1 updates strings
} elseif($type == 2) {
mysqli_query($db, "UPDATE Users SET $DBColunm = 'default.png' WHERE UserID='$UID'"); // Type 2 updates images
} else {
mysqli_query($db, "UPDATE Users SET $DBColunm = 'Missing Content' WHERE UserID='$UID'"); // Type 3 updates any other content
}
}
I know this is possible with PDO & Dynamic SQL, but are there any alternatives?