I have two MySQL queries to fetch data from a table.
Individually, the if ($query_one->num_rows() > 0)
and/or if ($query_two->num_rows() > 0)
work perfectly.
The Problem: However, when used in an elseif statement only the first query $query_one->num_rows()
fetches data. If the first query has no results, the second query $query_two->num_rows()
should trigger?
if ($query_one->num_rows() > 0)
{
return $query_one->row(0)->total;
}
else if($query_two->num_rows() > 0)
{
return $query_two->row(0)->total;
}
return 0;
I know there are posts on stackoverflow that show the correct way to implementing an elseif statement with queries, but I have already read them.
Thanks in advance