[thelist] php/mysql/html

Tom Dell'Aringa pixelmech at yahoo.com
Mon Aug 4 14:02:38 CDT 2003

--- Roger Harness <magic32 at jps.net> wrote:
> <td><img src='images/$rating_star.gif'></td>

> That last variable is $rating, (and I'm tring to concatenate the
> _star.gif). For now, $rating with contain either "1", "2", "3", 
> or "4".

Hi Roger, I'm not quite the expert in PHP but I will give you my .02

If you are going to try and concatenate the name of the gif file
inside your img tag, it's going to be messy. There is really no
reason you must do that. I would build the reference beforehand.

$starValue = 1;
$starBase = rating_star.gif;

$starImage = $starValue . "_" . $starBase;

<img src="images/$starImage">

The . is the concatenator in PHP. Remember in PHP double quotes says
look inside and interpret any $ variables. Single quotes ignores them
and would write out a dollar sign. (I hope I have that right,
sometimes I get it backwards...)

This is how I would do it, although see what some others might say.



http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: Premium Content Author / JavaScript / Every Friday!
http://www.maccaws.com/ :: Group Leader
[Making A Commercial Case for Adopting Web Standards]

"That's not art, that's just annoying." -- Squidward

More information about the thelist mailing list