Print something else if Database has empty cell

Hello i have this on a webpage

PrintFatherNode($father, 1);

Which will show the name of the Father if in the Fathers column of my database table.

I’m trying to add a way to print or echo something else like “Sorry Father not in Database” if the father ($father, 1) is empty in the Fathers column.

Thanks for Replies.

Well, that does not tell us much. But, assuming you get the records from a standard database, you would have something like $results = some results of a query.
So, let’s know how your database is set up. I am thinking that you have a fathers table and a child table. And, the father’s table would link to the children’s table. To do that you can just use a JOIN in your query.
Let us know more about your table layout and we can give you ideas how to handle it.

ErnieAlex, Tnanks for the reply, i only have one Table with several columns which include Name, Father and Mother columns,
I did not write the code so actually have no idea how it works.
Thought there would be an easy to print something else if ($Father,1) was empty like an if or else statement.
Sorry but i’m just starting in PHP.

Sponsor our Newsletter | Privacy Policy | Terms of Service