Jump to content

displaying results as images


xtiancjs

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
Link to comment
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]

Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.