I have a PHP code that I'm struggling to figure out. Essentially I want the code to check if variables equals a certain value and if they do then I want the DB to update with NULL, if it doesn't equal the value then it will write the variable to the DB.
PHP
$noteid = $_POST['id'];
$title = $_POST['title'];
$content = $_POST['content'];
if ($title == 'Type your title'){
$title = null;
} else {
$title = '$title';
}
if ($content == 'Type your note'){
$content = null;
} else {
$content = '$content';
}
$result = mysql_query("UPDATE notes SET title=$title, note=$content WHERE id='$noteid' AND uid = '$_SESSION[id]'");