if/elseif being treated as if/if

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey folks,

  Here's the deal.  I have the following code:

if($col_vals[$i][$val['column']] == $search_result[0][$col])
          { echo ' selected="selected"'; }
elseif($val['default'] == $col_vals[$i][$val['column']])
          { echo ' selected="selected"'; }

  It's supposed to check whether there's a value in the db
($search_result[0][$col]) that matches the current column value, and
if not, check whether the default matches it.  It does that, sort of.
In fact, both statements trigger, which I would have said wasn't
possible.

  So the question is:  what causes both parts of an if/elseif
statement to trigger?  As far as I can see my punctuation is correct,
and I've confirmed through debugging statements that all the values
are what I expect, so how do I make the elseif stop acting like
another if?  Or, alternatively, have I just misunderstood all this
time what the if/elseif statement does?

Thanks,
  Alex

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux