Why do I keep getting the total no. of rows instead of the value 0 when i’ve entered “” – empty ?
Controller
$totalSchools = $this->Classroom->find('count', array('conditions' => array('Classroom.name LIKE' => '%'. $searchQuery .'%')));
$this->set('totalSchools', $totalSchools);
View
<?php echo $totalSchools ?>
You should filter first your
$searchQueryif it is empty like here: