anonīms Posted June 1, 2009 Report Share Posted June 1, 2009 echo "Reitings (".reitinga_bilde($komanda['id'])."): ir tā, ka bilde parādas pirms paša vārda reitings. Kur varētu būt vaina? function reitinga_bilde($komandas_id) { $r_low = 500; $r_mid = 1000; $r_high = 2000; $rating_img = mysql_query("SELECT reitings FROM ".PREFIX."komandas WHERE id = '".$komandas_id."'"); $rating_img = mysql_fetch_array($rating_img); if($rating_img['reitings'] >= $r_high) { echo '<img src="image/reitings_high.jpg" alt="" style="width: 10px; height: 10px;" />'; } elseif($rating_img['reitings'] >= $r_mid) { echo '<img src="image/reitings_mid.jpg" alt="" style="width: 10px; height: 10px;" />'; } elseif($rating_img['reitings'] >= $r_low) { echo '<img src="image/reitings_low.jpg" alt="" style="width: 10px; height: 10px;" />'; } else { echo '<img src="image/reitings_low.jpg" alt="" style="width: 10px; height: 10px;" />'; } } Quote Link to comment Share on other sites More sharing options...
bubu Posted June 1, 2009 Report Share Posted June 1, 2009 Ja tu izsauc funkciju un sagaidi rezultātu, tad vajag lietot return, nevis echo funkcijas ķermenī. Quote Link to comment Share on other sites More sharing options...
anonīms Posted June 1, 2009 Author Report Share Posted June 1, 2009 un kā tad man izmantot to return? teiksim echo nomainīt pret $r_bilde = 'bilde.jpg'; un tad return $r_bilde ? Quote Link to comment Share on other sites More sharing options...
bubu Posted June 1, 2009 Report Share Posted June 1, 2009 Jā, tieši tādu return. Paskaties jebkurā php pamācībā dokumentācijā. return ir viena no funkciju pamata lietām - tā būs aprakstīta jebkur. Quote Link to comment Share on other sites More sharing options...
anonīms Posted June 1, 2009 Author Report Share Posted June 1, 2009 jap. $km_rating = reitinga_bilde($komanda['id']); function reitinga_bilde($komandas_id) { $r_low = 500; $r_mid = 1000; $r_high = 2000; $rating_img = mysql_query("SELECT reitings FROM ".PREFIX."komandas WHERE id = '".$komandas_id."'"); $rating_img = mysql_fetch_array($rating_img); if($rating_img['reitings'] >= $r_high) { $r_img = '<img src="image/reitings_high.jpg" alt="" style="width: 10px; height: 10px;" />'; } elseif($rating_img['reitings'] >= $r_mid) { $r_img = '<img src="image/reitings_mid.jpg" alt="" style="width: 10px; height: 10px;" />'; } elseif($rating_img['reitings'] >= $r_low) { $r_img = '<img src="image/reitings_low.jpg" alt="" style="width: 10px; height: 10px;" />'; } else { $r_img = '<img src="image/reitings_low.jpg" alt="" style="width: 10px; height: 10px;" />'; } return $r_img; } un echo $km_rating; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.