Jump to content
php.lv forumi

Recommended Posts

Posted

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;" />';
}

}

Posted

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.

Posted

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;

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...