i have been trying to insert NULL to my database if the value of input is empty
but i still it insert empty and NULL string
Here's my code
this code returns blank
if (empty($_POST['caller'])){ $caller= NULL; }else{ $caller = mysqli_real_escape_string($con, $_POST['caller']);}
or this
$caller = mysqli_real_escape_string($con, $_POST['caller']);
$caller = !empty($caller_contact) ? "'$caller'" : NULL;
this code returns NULL string
$caller = mysqli_real_escape_string($con, $_POST['caller']);
$caller = !empty($caller_contact) ? "'$caller'" : 'NULL';
or this
if (empty($_POST['caller'])){ $caller= 'NULL'; }else{ $caller = mysqli_real_escape_string($con, $_POST['caller']);}
query
$sql_caller = "INSERT INTO `tblcall_info` VALUES ('','$save_inc_id','$call_time','$call_date','$caller','$caller_contact','$receiver','$device')";
i have also tried changing '$caller' to $caller but its an error.
