Hi i need to do a simple query but something is wrong. I have $name and $surname and i need to search the (possible multiple) id that rappresent that name and surname and put all the id, name and surname in a array I do this query:
$result=$this->_db_table->select()->where('name=?',$name)
->where('surname=?', $surname)->query()
->fetchAll();
$array=$result->toArray();
return $array;
If i use
$result=$this->_db_table->fetchAll();
$array=$result->toArray();
return $array
it work correctly and i have an array whith all the value in the database in that table. What is wrong in my first code???
After doing this
$result is already an array its not an object . So simply use it instead of calling toArray on it.
Correct code wd be