Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Help with PHP "If" statement needed (https://www.warriorforum.com/programming/502882-help-php-if-statement-needed.html)

Kirk Ward 12th December 2011 02:03 PM

Help with PHP "If" statement needed
 
What is wrong with this code? It's breaking my page.

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

I want $i to max out at 34

723Media 12th December 2011 02:24 PM

Re: Help with PHP "If" statement needed
 
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.

Kirk Ward 12th December 2011 02:58 PM

Re: Help with PHP "If" statement needed
 
Quote:

Originally Posted by 723Media (Post 5222651)
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.


All times are GMT -6. The time now is 04:49 AM.