How I can achieve if the $_POST['sector']
is NULL , the bind value to be changed to 1
$stmt->bindValue(':sector', $_POST['sector'], PDO::PARAM_STR);
How I can achieve if the $_POST['sector']
is NULL , the bind value to be changed to 1
$stmt->bindValue(':sector', $_POST['sector'], PDO::PARAM_STR);
use this ternary condition, but you might want to use isset
instead:
$stmt->bindValue(':sector', !is_null($_POST['sector']) ? $_POST['sector'] : "anotherValue", PDO::PARAM_STR);