I'm a real newbie to php and I just cant figure this out! I want different images to appear depending on what rating value is returned from the database.How do I do that?! This is the code:
return '
<div class="comment">
<div class="name">'.$link_open.$d['name'].$link_close.'</div>
<div class="date" title="Added at '.date('H:i \o\n d M Y',$d['dt']).'">'.date('d M Y',$d['dt']).'</div>
<div class="rating">'.$d['rating'].'</div>
<p>'.$d['body'].'</p>
</div>
';
So if the value is 5 I want the image 5stars.png to show up. I thought maybe you could write something like:
<img src="img/<?php echo $row['rating']; ?>stars.png">
But that won't work inside the return statement. What do I have to write to be able to write php inside the ? Is it even possible?