Page 1 of 1

Display image with value

Posted: Sun Jan 23, 2011 7:39 pm
by weblearner
Hi all

Had setup a dynamic table query displaying all my fields correctly...
one of the fields is:
<td bgcolor="#CCCCCC"><?php echo $row_rsParts['PB']; ?></td>

the values of the column field 'PB' is either yes or no.
how do i make it display 'yes.gif' if the value is yes and 'spacer.gif' if the value is no.
Would appreciate if fellow friends could help me out and give me some pointers. Many thanks.

Re: Display image with value

Posted: Sun Jan 23, 2011 9:08 pm
by requinix

Re: Display image with value

Posted: Mon Jan 24, 2011 12:12 am
by phazorRise
weblearner wrote:Hi all

Had setup a dynamic table query displaying all my fields correctly...
one of the fields is:
<td bgcolor="#CCCCCC"><?php echo $row_rsParts['PB']; ?></td>

the values of the column field 'PB' is either yes or no.
how do i make it display 'yes.gif' if the value is yes and 'spacer.gif' if the value is no.
Would appreciate if fellow friends could help me out and give me some pointers. Many thanks.

Code: Select all

<?php if($row_rsParts['PB']=='yes')  
$img='yes.gif';
Elseif ($row_rsParts['PB']=='no')
$img='spacer.gif'; ?>
<img src='<?php echo $img; ?>' >

Re: Display image with value

Posted: Fri Jan 28, 2011 4:33 am
by weblearner
hey phazorRise

many thanks for helping, had followed your code and it works. :)