I have the following code so far:
$update = $connection->prepare("UPDATE recommendations_tbl
SET IFNULL(?, PLEASE_DO_NOTHING()),
IFNULL(?, PLEASE_DO_NOTHING()),
WHERE recommendation_userid = ?
");
$update->bindValue(1, $recommendationsDataInput["recommendationCategoryNameInput"]);
$update->bindValue(2, $recommendationsDataInput["recommendationManufacturerNameInput"]);
$update->bindValue(3, $recommendationUserID);
$updateResult = $insertion->execute();
Now, I'm pretty new to prepared statements and I just learned about using IFNULL inside prepared statements here: Logic to NOT insert a value to column X in a prepared statement
I'm not sure if the syntax, apart from my little placeholder PLEASE_DO_NOTHING(), would actually work at all. However, my main issue right now is that I don't know if I can actually use IFNULL() in this way: If the inputvalue is defined, SET the new value. If the inputvalue is undefined (=NULL), don't do anything.
Is this possible and if so, how can I do it?