lundi 18 mai 2015

php: show html if a field in database is NOT empty

I know this question in some form has been asked before, but somehow it still goes wrong in my case...

I want to show some HTML if a certain database field is NOT empty. So after following numerous options I got the following code:

<?
if ($remark!=="") 
{ 
echo "<tr class=\"warning\"><td colspan=\"5\">REMARK: $item->remark </td></tr>";
} 
?>

But the code is generated in every case, also if the field is empty. Also, I got the following message: Notice: Undefined variable: remark in...

If the field is empty, nothing needs to happen.

Thanks for the tips!

Aucun commentaire:

Enregistrer un commentaire