I have the following code.
Can anyone see why the first option always evaluates to true even though they should not. For example if i set $catselect to 17 or $orderby to event or both at the same time, the first part of the statement is executed. ??
if (($orderby == null or 'all') && ($catselect == null or 'viewall'))
{
$query = "SELECT FROM Events Limit 1";
}
elseif (($orderby == null or 'all') && ($catselect != null or 'viewall'))
{
$query = "SELECT FROM Events WHERE categoryid='$catselect' Limit 2";
}
elseif (($orderby != null or 'all') && ($catselect == null or 'viewall'))
{
$query = "SELECT FROM Events ORDER BY $orderby Limit 3";
}
elseif (($orderby != null or 'all') && ($catselect != null or 'viewall'))
{
$query = "SELECT FROM Events WHERE categoryid='$catselect' ORDER BY $orderby Limit 4";
}