Fetch an array in zend framework

115 Views Asked by At

I am new with zend and I don't know how to fetch an array into a view (phtml).

This is my array:

[["0","Henedy"],["0","Samer"],["0","Walid"]]

and this is my controller and my model table code :

public function getUsersCoNbre()
{
    $select = new Select();
    $select->from('user');
    $select->columns(array('*'));
    $select->join(
        'co_addi_info',
        'user.pin = co_addi_info.user_pin',
        array('co_nbre'),
        'inner'
    );
    $statement = $this->tableGateway->getSql()->prepareStatementForSqlObject($select);
    $resultSet = $statement->execute();

    return $resultSet;
} 

public function indexAction()
{
    $users_co_nbre = iterator_to_array($this->getAddiinfoTable()->getUsersCoNbre());

    // $jsonres = Json::encode($users_co_nbre);
    // print_r($jsonres);die;
    $view = new ViewModel();
    $view->setTemplate('covoiturage/covoiturage/admin/statistics');
    $view->setVariables(array(
        'users_co_nbre' => $users_co_nbre,
    ));

    return $view;
}
0

There are 0 best solutions below