Re: [PHP] What's wrong with this IF statement?

2004-04-22 Thread Richard Davey
Hello Robert, Thursday, April 22, 2004, 8:02:55 PM, you wrote: RS $cat_id = $cats[id_num]; Try this: $cat_id = $cats['id_num']; You need to quote array elements otherwise PHP expects a constant. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General

RE: [PHP] What's wrong with this IF statement?

2004-04-22 Thread Michael Sims
John W. Holmes wrote: You want instead of || if ($cat_id != 53 $cat_id != 54 $cat_id != 55 $cat_id != 117 $cat_id != 118 $cat_id != 74) For stuff like this I've always found the following slightly easier on the eyes: if (!in_array($cat_id, array('53', '54', '55', '117', '118', '74')))

[PHP] What's wrong with this IF statement?

2004-04-22 Thread Robert Sossomon
My IF statement should be picking up on the numbers, and if the number matches not be displaying out the information, however I look at the outputted page and the information is still there, what have I got wrong on the code? CODE SNIPPET //Show categories first $get_cats = select id_num,

Re: [PHP] What's wrong with this IF statement?

2004-04-22 Thread Daniel Clark
What about removing the quotes around the numbers. if ($cat_id != 53 || $cat_id != 54 || $cat_id != 55 etc... My IF statement should be picking up on the numbers, and if the number matches not be displaying out the information, however I look at the outputted page and the information is

Re: [PHP] What's wrong with this IF statement?

2004-04-22 Thread John W. Holmes
From: Robert Sossomon [EMAIL PROTECTED] if ($cat_id != 53 || $cat_id != 54 || $cat_id != 55 || $cat_id != 117 || $cat_id != 118 || $cat_id != 74) Okay, if $cat_id is 53, this will work out to: if(FALSE || TRUE || TRUE || TRUE || TRUE || TRUE) which results in TRUE overall. You want

Re: [PHP] What's wrong with this IF statement?

2004-04-22 Thread Chris Shiflett
--- Robert Sossomon [EMAIL PROTECTED] wrote: if ($cat_id != 53 || $cat_id != 54 || $cat_id != 55 || $cat_id != 117 || $cat_id != 118 || $cat_id != 74) That looks like a pretty big logical flaw to me. Just read that out loud to yourself. It should be clear that this statement is equivalent to: