isset - right way to go ?
Posted: Tue Jul 20, 2010 5:51 am
I have a tiny snippet of code which I want to use, based on if three table options have been filled in or not.
The options will be NULL for 90% of the time, but for those that aren't I want to use the following:
Basically to show some pictures and a few words from the database, however (not my code to start with and most of the site is icky) but the isset($row2->ccolour) doesnt work, the extra table line comes up for empty sets too.
The other thing I want to do is to make sure this happens if ANY of those three options, pack, ccolour and tcolour have been chosen (maybe best for me to split it up?)
Thanks in advance,
Aravona
The options will be NULL for 90% of the time, but for those that aren't I want to use the following:
Code: Select all
<?php if(isset($row2->ccolour)){
?>
<tr style="<?=$bgcolor?>">
<td width="85%" align="left" colspan="8"><?=$row2->pack?> <img src="<?=$row2->ccolour?>" /> <img src="<?=$row2->tcolour?>" /></td>
</tr>
<?php
}
?>The other thing I want to do is to make sure this happens if ANY of those three options, pack, ccolour and tcolour have been chosen (maybe best for me to split it up?)
Thanks in advance,
Aravona