Help with PHP "If" statement needed

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

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

I want $i to max out at 34
#help needed #needed #php #statement
  • Profile picture of the author 723Media
    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.
    {{ DiscussionBoard.errors[5222651].message }}
    • Profile picture of the author Kirk Ward
      Originally Posted by 723Media View Post

      Going by what you typed:

      if ( >= 35) $1 = 34 ;

      Should be

      if ( >= 35) = 34 ;

      You have a variable of $1 instead of .
      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.
      Signature
      "We are not here to sell a parcel of boilers and vats, but the potentiality of growing rich beyond the dreams of avarice."

      Dr. Samuel Johnson (Presiding at the sale of Thrales brewery, London, 1781)
      {{ DiscussionBoard.errors[5222842].message }}

Trending Topics