You are here: Re: whats wrong with this statment? « PHP Language « IT news, forums, messages
Re: whats wrong with this statment?

Posted by Brian on 05/27/05 02:04

>> Hi all
>>
>> whats wrong with this?
>>
>> if ( (strtolower($myrow[status]) != 'n') || (strtolower($myrow[status])
>> !=
>> 'u') ) {
>> .......
>> }
>>
>> I'm trying to say if $myrow[status]) if not 'n' or 'u' then do X but it's
>> just not
>> playing ball here? I have tried putting in brackets, taking them out,
>> moving them about and all sorts, just can't get it to work
>>
>
> For starters, the line is too long and unnecessarily re-evaluating the
> function.
>
> It's doing exactly what you tell it - you have a semantic error in your
> program. Try making it a bit simpler and it might be clearer:
>
> $ch = strtolower($myrow[status]);
> if ( ($ch!='n') || ($ch!='u') ) { ...
>
> At least one of the two expressions will always be true (since $ch cannot
> be
> 'u' and 'n' at the same time)
>
> I suspect you really mean not 'n' *AND* not 'u'
>
> HTH
>
> C.

WHAT THE HELL AM I ON???

Thanks guys, I have gone brain dead on this project, I need a break from it
as I am making silly mistakes that I should know better on, like AND instead
of
OR
That's what happens when you client changes things haft way though writing
the code, you end up with a 1 brain dead programmer and code that looks and
acts S**t !



Thanks guys

Brain dead Brian


Brian

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация