At first I posted my code:
//if ($filterResults['id']) {
if (isset($filterResults['id'])){
$select = $this->select();
$select->where('id = ?', $filterResults['id']);
$this->fetchAll($select);
}
Now, the problem is if I use if ($filterResults['id']) {
it gives the expected result but if I use if (isset($filterResults['id'])){
it doesn't work. I don't see any reason behind this.
It works if I use the isset() like this:
if ( isset($filterResults['id']) && $filterResults['id'] != null ){
$select = $this->select();
$select->where('id = ?', $filterResults['id']);
$this->fetchAll($select);
}