Jump to content

Need Help With Else If Script


ryanfilard

Recommended Posts

This does not work correctly and I need help with it. If $rating is equal to zero it displays 4 stars on this page http://rwdev.whekle.com/view.php?id=4571

what I am doing wrong, it is probably a simple mistake.

if($rating <= '1.5'){
   $star1 = "yes";
}elseif($rating <= '2.5'){
    $star2 = "yes";
}elseif($rating <= '3.5'){
     $star3 = "yes";
}elseif($rating <= '4.5'){
       $star4 = "yes";
}elseif($rating <= '5.0'){
   $star5 = "yes";
}

Link to comment
Share on other sites

if($rating <= 1.5 && $rating > 0){ // IF rating is Less Than or Equal to 1.5 AND greater than zero... $star1 = 'yes';
   $star1 = "yes";
}elseif($rating <= 2.5 && $rating > 1.5){
    $star2 = "yes";
}elseif($rating <= 3.5 && $rating > 2.5){
     $star3 = "yes";
}elseif($rating <= 4.5 && $rating > 3.5){
       $star4 = "yes";
}elseif($rating <= 5.0 && $rating > 4.5){
   $star5 = "yes";
}

that should do the trick. I think...

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.