[thelist] php/mysql/html

Henry Wong hwong at dja.com
Mon Aug 4 14:05:38 CDT 2003


while .... {

   print "<tr>";
   print "<td>$title</td>";

   // see rest below..

   // one of many ways to do it..
   printf ('<td><img src="imgaes/%s_star.gif"></td>', $rating);
}


On Mon, 2003-08-04 at 14:52, Roger Harness wrote:
> 'Volters. I have a two-parter, but I'm just going to ask the first part
> first.
> 
> I'm a beginning PHP'er, so hopefully I'm just sort of dense on this one.
> 
> I have a simple database, with movies, categories, actors, and personal
> ratings (1-4 stars).
> 
> I have a simple while loop that is supposed to go something like this:
> 
> <tr>
> <td>$title</td>
> <td>$category</td>
> <td>$actor_1</td>
> <td>$actor_2</td>
> <td><img src='images/$rating_star.gif'></td>
> </tr>
> 
> 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".
> 
> So if i did it correctly, I'd have an <a href='images/1_star.gif'> html tag.
> This *almost* works. But it won't. My output is <img src='images/.gif'>
> 
> Now I *can* mess around with the $rating data and have it contain 1_star.gif
> and use <img src='images/$rating'> and THAT will work fine.
> 
> But for what i'm doing, i'd really like to just have 1, 2, 3, 4 and
> concatenate (?) the _star.gif to the end. I've tried every combo of single
> quotes, double quotes, excaped quotes, etc etc, and i either just get <img
> src='images/_star.gif'> (or something similiar) or just get parsing errors.
> 
> This *should* be do-able, right? Any Suggestions/tips/advice?? Does this
> even make sense??
> 
> as always, tia!
> 
> -Roger Harness
-- 
Henry Wong <hwong at dja.com>



More information about the thelist mailing list