problem with ordering mysql results |
[eluser]Frank Berger[/eluser]
Hi, try this for your case-block: Code: switch($sort_by_case){ Unless you want the effect and chain the cases together you _have_ to add the break; statement to the end of each case. Furthermore every switch should have a default: case, even if it is the same as another case or empty. switch in php works like this: it will look for the first matching case and execute all code after this case (even if the code is part of another case following the found statement) until the end of the switch loop or until it encounters a break; or continue; statement. This behavior can be useful to avoid code duplication, but makes the code harder to understand and opens possible security holes and bugs. So to be on the safe side, always add the breaks; and the default:-case. more info on this here: http://php.net/switch cheers Frank |
Messages In This Thread |
problem with ordering mysql results - by El Forum - 09-07-2008, 06:06 PM
problem with ordering mysql results - by El Forum - 09-07-2008, 07:25 PM
problem with ordering mysql results - by El Forum - 09-07-2008, 07:29 PM
|