0

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.

kmoser
  • 8,780
  • 3
  • 24
  • 40
psp
  • 13
  • 2
  • Does this answer your question? [Check if a variable is empty](https://stackoverflow.com/questions/2659837/check-if-a-variable-is-empty) – nbk Jul 18 '20 at 14:25

1 Answers1

0

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);
}?>
nbk
  • 45,398
  • 8
  • 30
  • 47