Before, I insert data to database using normal sql code and I use ("") to insert the empty var into database.
Now I use pdo and I use (NULL) to insert the empty value to database.
I know that ("") and (NULL) is different. But I get problem to script the variable that´s NULL....well maybe I´m not good at explaining. let´s see my script:
$problem=$rs['problem']; ///Here comes with the NULL from database.
if (is_null($problem)) {
echo"this is null";
} else {
echo"this is not null";
}
OR
if (empty($problem) ) {
echo "this is null";
} else {
echo "this is not null";
}
OR
if (isset($problem)==NULL) {
echo "this is null";
} else {
echo "this is not null ";
}
Whether there´re empty or have data in the table, the result I get from these 3 script is only "this is null"
I have no idea how I can get this correct.