Laravel floating if greater 85 not working. It show always smaller than 85










-1














I am learning about backend and Laravel recently.



I am stuck on if function() that using floating type on my project.



<td>
$participant->vt_avg,
@if($participant->vt_avg > 85)
x
@else
y
@endif
</td>


It should print vt_avg score, it's "x" if greater than 85 and "y" if smaller than 85.



But it turns out vt_avg,y
the result shows that all vt_avg is smaller than 85



enter image description here



Can you please help me? I am stuck with this code.










share|improve this question























  • "Number y" is a string its not an integer ?
    – Anar Bayramov
    Nov 13 '18 at 5:55










  • so, i want to print string x if it vt_avg greater than 85 and string y if it smaller than 85
    – Michael Ritung
    Nov 13 '18 at 6:00











  • can you share your database too I thought its database records
    – Anar Bayramov
    Nov 13 '18 at 6:01







  • 1




    Also, is it 8.5 or 85?
    – hktang
    Nov 13 '18 at 6:13






  • 1




    There's no visible example of vt_avg being greater than 85. Everything in your example is smaller than 11
    – apokryfos
    Nov 13 '18 at 6:37















-1














I am learning about backend and Laravel recently.



I am stuck on if function() that using floating type on my project.



<td>
$participant->vt_avg,
@if($participant->vt_avg > 85)
x
@else
y
@endif
</td>


It should print vt_avg score, it's "x" if greater than 85 and "y" if smaller than 85.



But it turns out vt_avg,y
the result shows that all vt_avg is smaller than 85



enter image description here



Can you please help me? I am stuck with this code.










share|improve this question























  • "Number y" is a string its not an integer ?
    – Anar Bayramov
    Nov 13 '18 at 5:55










  • so, i want to print string x if it vt_avg greater than 85 and string y if it smaller than 85
    – Michael Ritung
    Nov 13 '18 at 6:00











  • can you share your database too I thought its database records
    – Anar Bayramov
    Nov 13 '18 at 6:01







  • 1




    Also, is it 8.5 or 85?
    – hktang
    Nov 13 '18 at 6:13






  • 1




    There's no visible example of vt_avg being greater than 85. Everything in your example is smaller than 11
    – apokryfos
    Nov 13 '18 at 6:37













-1












-1








-1


0





I am learning about backend and Laravel recently.



I am stuck on if function() that using floating type on my project.



<td>
$participant->vt_avg,
@if($participant->vt_avg > 85)
x
@else
y
@endif
</td>


It should print vt_avg score, it's "x" if greater than 85 and "y" if smaller than 85.



But it turns out vt_avg,y
the result shows that all vt_avg is smaller than 85



enter image description here



Can you please help me? I am stuck with this code.










share|improve this question















I am learning about backend and Laravel recently.



I am stuck on if function() that using floating type on my project.



<td>
$participant->vt_avg,
@if($participant->vt_avg > 85)
x
@else
y
@endif
</td>


It should print vt_avg score, it's "x" if greater than 85 and "y" if smaller than 85.



But it turns out vt_avg,y
the result shows that all vt_avg is smaller than 85



enter image description here



Can you please help me? I am stuck with this code.







php laravel if-statement laravel-5 condition






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 '18 at 9:10









Sayed Mohd Ali

7681317




7681317










asked Nov 13 '18 at 5:43









Michael RitungMichael Ritung

126




126











  • "Number y" is a string its not an integer ?
    – Anar Bayramov
    Nov 13 '18 at 5:55










  • so, i want to print string x if it vt_avg greater than 85 and string y if it smaller than 85
    – Michael Ritung
    Nov 13 '18 at 6:00











  • can you share your database too I thought its database records
    – Anar Bayramov
    Nov 13 '18 at 6:01







  • 1




    Also, is it 8.5 or 85?
    – hktang
    Nov 13 '18 at 6:13






  • 1




    There's no visible example of vt_avg being greater than 85. Everything in your example is smaller than 11
    – apokryfos
    Nov 13 '18 at 6:37
















  • "Number y" is a string its not an integer ?
    – Anar Bayramov
    Nov 13 '18 at 5:55










  • so, i want to print string x if it vt_avg greater than 85 and string y if it smaller than 85
    – Michael Ritung
    Nov 13 '18 at 6:00











  • can you share your database too I thought its database records
    – Anar Bayramov
    Nov 13 '18 at 6:01







  • 1




    Also, is it 8.5 or 85?
    – hktang
    Nov 13 '18 at 6:13






  • 1




    There's no visible example of vt_avg being greater than 85. Everything in your example is smaller than 11
    – apokryfos
    Nov 13 '18 at 6:37















"Number y" is a string its not an integer ?
– Anar Bayramov
Nov 13 '18 at 5:55




"Number y" is a string its not an integer ?
– Anar Bayramov
Nov 13 '18 at 5:55












so, i want to print string x if it vt_avg greater than 85 and string y if it smaller than 85
– Michael Ritung
Nov 13 '18 at 6:00





so, i want to print string x if it vt_avg greater than 85 and string y if it smaller than 85
– Michael Ritung
Nov 13 '18 at 6:00













can you share your database too I thought its database records
– Anar Bayramov
Nov 13 '18 at 6:01





can you share your database too I thought its database records
– Anar Bayramov
Nov 13 '18 at 6:01





1




1




Also, is it 8.5 or 85?
– hktang
Nov 13 '18 at 6:13




Also, is it 8.5 or 85?
– hktang
Nov 13 '18 at 6:13




1




1




There's no visible example of vt_avg being greater than 85. Everything in your example is smaller than 11
– apokryfos
Nov 13 '18 at 6:37




There's no visible example of vt_avg being greater than 85. Everything in your example is smaller than 11
– apokryfos
Nov 13 '18 at 6:37












3 Answers
3






active

oldest

votes


















0














you should try this:



<td>
$participant->vt_avg,
@if($participant->vt_avg > 8.5)
x
@else
y
@endif
</td>





share|improve this answer




















  • it should 8.5. Thank you.
    – Michael Ritung
    Nov 13 '18 at 6:52


















0














change



@if($participant->vt_avg > 85)


to



@if(floatval($participant->vt_avg > 85))


Read about floatval






share|improve this answer




























    0














    How about using floatval() to get the value from string:



    (Assuming you want to compare the average with 8.5, not 85)



    <td>
    $participant->vt_avg,
    @if(floatal($participant->vt_avg) > 8.5)
    x
    @else
    y
    @endif
    </td>


    See: http://php.net/manual/en/function.floatval.php






    share|improve this answer






















    • i have try it but didnt work. the result is just the same even without using floatval(). because vt_avg is already float
      – Michael Ritung
      Nov 13 '18 at 6:17






    • 1




      I see. Do you want to campare the number with 85 or 8.5? It seems your vt_avg is less than 10. @MichaelRitung
      – hktang
      Nov 13 '18 at 6:20











    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53274543%2flaravel-floating-if-greater-85-not-working-it-show-always-smaller-than-85%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    you should try this:



    <td>
    $participant->vt_avg,
    @if($participant->vt_avg > 8.5)
    x
    @else
    y
    @endif
    </td>





    share|improve this answer




















    • it should 8.5. Thank you.
      – Michael Ritung
      Nov 13 '18 at 6:52















    0














    you should try this:



    <td>
    $participant->vt_avg,
    @if($participant->vt_avg > 8.5)
    x
    @else
    y
    @endif
    </td>





    share|improve this answer




















    • it should 8.5. Thank you.
      – Michael Ritung
      Nov 13 '18 at 6:52













    0












    0








    0






    you should try this:



    <td>
    $participant->vt_avg,
    @if($participant->vt_avg > 8.5)
    x
    @else
    y
    @endif
    </td>





    share|improve this answer












    you should try this:



    <td>
    $participant->vt_avg,
    @if($participant->vt_avg > 8.5)
    x
    @else
    y
    @endif
    </td>






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 13 '18 at 6:29









    Saurabh DhariwalSaurabh Dhariwal

    1,190113




    1,190113











    • it should 8.5. Thank you.
      – Michael Ritung
      Nov 13 '18 at 6:52
















    • it should 8.5. Thank you.
      – Michael Ritung
      Nov 13 '18 at 6:52















    it should 8.5. Thank you.
    – Michael Ritung
    Nov 13 '18 at 6:52




    it should 8.5. Thank you.
    – Michael Ritung
    Nov 13 '18 at 6:52













    0














    change



    @if($participant->vt_avg > 85)


    to



    @if(floatval($participant->vt_avg > 85))


    Read about floatval






    share|improve this answer

























      0














      change



      @if($participant->vt_avg > 85)


      to



      @if(floatval($participant->vt_avg > 85))


      Read about floatval






      share|improve this answer























        0












        0








        0






        change



        @if($participant->vt_avg > 85)


        to



        @if(floatval($participant->vt_avg > 85))


        Read about floatval






        share|improve this answer












        change



        @if($participant->vt_avg > 85)


        to



        @if(floatval($participant->vt_avg > 85))


        Read about floatval







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 13 '18 at 6:32









        Danyal SandeeloDanyal Sandeelo

        8,20622141




        8,20622141





















            0














            How about using floatval() to get the value from string:



            (Assuming you want to compare the average with 8.5, not 85)



            <td>
            $participant->vt_avg,
            @if(floatal($participant->vt_avg) > 8.5)
            x
            @else
            y
            @endif
            </td>


            See: http://php.net/manual/en/function.floatval.php






            share|improve this answer






















            • i have try it but didnt work. the result is just the same even without using floatval(). because vt_avg is already float
              – Michael Ritung
              Nov 13 '18 at 6:17






            • 1




              I see. Do you want to campare the number with 85 or 8.5? It seems your vt_avg is less than 10. @MichaelRitung
              – hktang
              Nov 13 '18 at 6:20
















            0














            How about using floatval() to get the value from string:



            (Assuming you want to compare the average with 8.5, not 85)



            <td>
            $participant->vt_avg,
            @if(floatal($participant->vt_avg) > 8.5)
            x
            @else
            y
            @endif
            </td>


            See: http://php.net/manual/en/function.floatval.php






            share|improve this answer






















            • i have try it but didnt work. the result is just the same even without using floatval(). because vt_avg is already float
              – Michael Ritung
              Nov 13 '18 at 6:17






            • 1




              I see. Do you want to campare the number with 85 or 8.5? It seems your vt_avg is less than 10. @MichaelRitung
              – hktang
              Nov 13 '18 at 6:20














            0












            0








            0






            How about using floatval() to get the value from string:



            (Assuming you want to compare the average with 8.5, not 85)



            <td>
            $participant->vt_avg,
            @if(floatal($participant->vt_avg) > 8.5)
            x
            @else
            y
            @endif
            </td>


            See: http://php.net/manual/en/function.floatval.php






            share|improve this answer














            How about using floatval() to get the value from string:



            (Assuming you want to compare the average with 8.5, not 85)



            <td>
            $participant->vt_avg,
            @if(floatal($participant->vt_avg) > 8.5)
            x
            @else
            y
            @endif
            </td>


            See: http://php.net/manual/en/function.floatval.php







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 13 '18 at 6:36

























            answered Nov 13 '18 at 6:11









            hktanghktang

            9391329




            9391329











            • i have try it but didnt work. the result is just the same even without using floatval(). because vt_avg is already float
              – Michael Ritung
              Nov 13 '18 at 6:17






            • 1




              I see. Do you want to campare the number with 85 or 8.5? It seems your vt_avg is less than 10. @MichaelRitung
              – hktang
              Nov 13 '18 at 6:20

















            • i have try it but didnt work. the result is just the same even without using floatval(). because vt_avg is already float
              – Michael Ritung
              Nov 13 '18 at 6:17






            • 1




              I see. Do you want to campare the number with 85 or 8.5? It seems your vt_avg is less than 10. @MichaelRitung
              – hktang
              Nov 13 '18 at 6:20
















            i have try it but didnt work. the result is just the same even without using floatval(). because vt_avg is already float
            – Michael Ritung
            Nov 13 '18 at 6:17




            i have try it but didnt work. the result is just the same even without using floatval(). because vt_avg is already float
            – Michael Ritung
            Nov 13 '18 at 6:17




            1




            1




            I see. Do you want to campare the number with 85 or 8.5? It seems your vt_avg is less than 10. @MichaelRitung
            – hktang
            Nov 13 '18 at 6:20





            I see. Do you want to campare the number with 85 or 8.5? It seems your vt_avg is less than 10. @MichaelRitung
            – hktang
            Nov 13 '18 at 6:20


















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53274543%2flaravel-floating-if-greater-85-not-working-it-show-always-smaller-than-85%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Top Tejano songwriter Luis Silva dead of heart attack at 64

            ReactJS Fetched API data displays live - need Data displayed static

            政党