Skip to content
Advertisement

How to disable title if MySql field is blank/null/none [closed]

I am trying to display profile from MySql database using PHP, here is the simple code:

<b>Professional Society Membership:</b> <br>
<?php echo htmlentities($result->society_member);?>

Now I do not want to display Professional Society Membership if the MySql field “society_member” is empty / blank.

Thank you in advance.

Advertisement

Answer

You have to check before your add the content of it is empty

<?php
    if (!empty($result->society_member)) {
?>
    <b>Professional Society Membership:</b> <br><?php echo htmlentities($result->society_member);
}?>
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement