Jump to content

Archived

This topic is now archived and is closed to further replies.

xtiancjs

displaying results as images

Recommended Posts

Hi, I have a result from the division of 2 fields from my DB. what I want to achieve is to display this result as an image, the image displayed would depend on the result.
this is the code that displays the result -
[!--coloro:#6600CC--][span style=\"color:#6600CC\"][!--/coloro--]<?php echo $row_bprofile['broker_rating']/$row_bprofile['broker_num_votes']; ?>[!--colorc--][/span][!--/colorc--]

and this is the code from the original update query -
[!--coloro:#333399--][span style=\"color:#333399\"][!--/coloro--]$updateSQL = sprintf("UPDATE brokers SET broker_rating= broker_rating + %s, broker_num_votes=%s + 1 WHERE id=%s"[!--colorc--][/span][!--/colorc--]

right now this displays some nasty huge decimal number, can anybody help me with this?
thanks xtian

Share this post


Link to post
Share on other sites
Unless I'm misunderstanding, your wanting something like:

[code]$num = $row_bprofile['broker_rating']/$row_bprofile['broker_num_votes'];

if ($num > 0 && $num <= .1) {
  echo '<img src="10percent.jpg">';
} else if ($num > .1 && $num <= .2) {
  echo '<img src="20percent.jpg">';
}  

and so on.......[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=356461:date=Mar 19 2006, 02:54 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 19 2006, 02:54 PM) [snapback]356461[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Unless I'm misunderstanding, your wanting something like:

[code]$num = $row_bprofile['broker_rating']/$row_bprofile['broker_num_votes'];

if ($num > 0 && $num <= .1) {
  echo '<img src="10percent.jpg">';
} else if ($num > .1 && $num <= .2) {
  echo '<img src="20percent.jpg">';
}  

and so on.......[/code]
[/quote]


thanks for the reply, I'll give it a shot!!!
Xtian

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.