Jump to content


Photo

displaying results as images


  • Please log in to reply
2 replies to this topic

#1 xtiancjs

xtiancjs
  • Members
  • PipPipPip
  • Advanced Member
  • 47 posts

Posted 19 March 2006 - 07:34 PM

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

#2 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 19 March 2006 - 07:54 PM

Unless I'm misunderstanding, your wanting something like:

$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.......



#3 xtiancjs

xtiancjs
  • Members
  • PipPipPip
  • Advanced Member
  • 47 posts

Posted 19 March 2006 - 08:02 PM

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

$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.......
[/quote]


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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users