If statement with isset?

I am having a bit of a problem with some php and would appreciate any help.

I have a int field that may be empty because the person doesn't exist in that table or it may have a 0 because the person exists, but doesn't have any data and mysql entered a 0.

So, I tried this:
<?if($MCol11 == "0"){echo "";} else {echo "Total";}?>

Works great until I run across someone who doesn't exist in the table. The word 'Total' shows up because they don't have a 0.

So, I tried this:
<? if (isset($MCol11)) {echo 'Total';} else {echo '';} ?>

It just reverses the problem.

How do I combine the two so that if the person doesn't exist or has a 0, don't display the word 'Total'?

Thanks for you help!

 
Mada123Asked:
Who is Participating?
 
Thomas4019Commented:
Try this
<?if(isset($MCol11) && ($MCol11 != "0")){echo "Total";} else {echo "";}?>

Open in new window

0
 
Mada123Author Commented:
Excellent! Works perfectly. Thanks so much for your help!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.