Support the ongoing development of Laravel.io →
posted 8 years ago
Input

Hello, I have a simple question, in my controller, i want to assign a string value to a variable according to an if else statement.. but the condition is always spitting out the first condition.

if (($imc->imccalculad) < 16.00)
        {
            $imc->clasificacion = 'Delgadez severa';
        }
        elseif (($imc->imccalculad >= 16.00) && ($imc->imccalculad <= 16.99))
        {
            $imc->clasificacion = 'Delgadez moderada';
        }
        elseif (($imc->imccalculad >= 17.00) && ($imc->imccalculad <= 18.40))
        {
            $imc->clasificacion = 'Delgadez leve';
        }

I'll appreciate if someone can tell me where i am going wrong.. Thanks!

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

codemode codemode Joined 18 Feb 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.