6
I’m trying to create a session on Zend
as follows:
if (isset($_POST['login'])) {
Zend_Session::start();
$session = new Zend_Session_Namespace();
$login = explode('-', $_POST['login']);
$codigo = $login[1];
$banco = $admin->fetchAll('SELECT banco FROM tbl_clientes WHERE codigo = ' . $codigo);
Zend_Registry::set('banco', $banco[0]['banco']);
$session->banco = $banco[0]['banco'];
}
But when trying to access the variable $session->banco
on another page it simply doesn’t exist!
OBS.
As soon as I assign her value, she gets the value of $banco[0]['banco']
.
Normally, I need this value to be able to set the defaultAdapter
of Zend_Db_Table
and make it available in the app so I can access the bank.
This bank will be on a record in the query I’m doing above.
I was trying to treat all this in the Bootstrap.php
but I saw that it is not very certain, somehow I am struggling to save this information, the bank returns me the following error:
'No adapter found for models_DbTable_TblChamado'
If there’s a better way to do that, I’m open to suggestions.
On the other page you ran the
Zend_Session::start();
again before accessing the$session->banco
?– eminetto
I recommend you take a look at the ZF2. It was nice mt, mainly the Servicemanager and Eventmanager schemes. They are powerful mt tools, especially if used together with the new modules system
– eminetto