xtiancjs Posted March 19, 2006 Share Posted March 19, 2006 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 https://forums.phpfreaks.com/topic/5306-displaying-results-as-images/ Share on other sites More sharing options...
hitman6003 Posted March 19, 2006 Share Posted March 19, 2006 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 https://forums.phpfreaks.com/topic/5306-displaying-results-as-images/#findComment-18850 Share on other sites More sharing options...
xtiancjs Posted March 19, 2006 Author Share Posted March 19, 2006 [!--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 https://forums.phpfreaks.com/topic/5306-displaying-results-as-images/#findComment-18856 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.