Skip to content
Advertisement

if column is null echoing in php getting wrong

I am creating a website in html using php and sql. there is a small section in which if the query didnt find the value, php will echo a message called vacant, but if the query finds the value in column, it will echo filled. the code is like below:

Now when I load the page, even if the value is present in the column, its still showing “vacant”. Can anyone please help me with my code?

Advertisement

Answer

Note the ===

When use ==, as you did, PHP treats NULL, false, 0, the empty string, and empty arrays as equal

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement