I am not having much luck detecting when a database query in Codeigniter returns zero results. I have had a good read of the notes on the PHP count function but am none the
If you put count($result) in if statement then when it succeds, it returns only 1.
count($result)
if
1
You can try $query->num_rows() in a different way.
$query->num_rows()