Help with PHP "If" statement needed

by 2 replies
3
What is wrong with this code? It's breaking my page.

if ($i >= 35) $1 = 34 ;

I want $i to max out at 34
#programming #help needed #needed #php #statement
  • Going by what you typed:

    if ($i >= 35) $1 = 34 ;

    Should be

    if ($i >= 35) $i = 34 ;

    You have a variable of $1 instead of $i.
    • [ 1 ] Thanks
    • [1] reply
    • That would be a big OOPS.

      I redid it and added brackets, so I'll bet I corrected it without even realizing the error.

      I'm now using ...

      if ($i >= 35) { $i = 34 ; }

      and it is working. Don't know if the brackets helped or wer indifferent. I'm betting on the indifferent after viewing your solution.

      I am so ashamed.

      Sigh.

      Thanks a bunch.

Next Topics on Trending Feed