> I've got a field in my database that contains a single numerical character
> ("1" or "2" or "3", etc.). I need to load a different background image in
> one cell of a table depending upon what the number the field contains.
> What's the easy syntax for associating entries in the field ("1" or "2" or
> "3", etc.) with image filenames ("bkgrnd-default.gif" or
> "bkgrnd-positive.gif" or "bkgrnd-negative.gif", etc.)

 $images[1] = 'bkgrnd-default.gif';
 $images[2] = 'bkgrnd-positive.gif';
 $images[3] = 'bkgrnd-negative.gif';

do you query, get the result in a variable, I'll use $field

<img src="<?php echo $images[$field];?>" />

you could do some error checking to make sure the value in $field
exists in the $images array

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to