My script is a function (query.php) that does a query in the mysql database and with the while I go through all the contents of the object ($ qr = $ query-> fetch_object ())) If I give a print_r here inside I can see all the data but when I try to use the return to get the data in another page nothing happens.
Thank you in advance.
while($data = $query->fetch_object()){
$data->id;
$data->modelo;
$data->login;
$data->senha;
$data->cadin;
$data->cadin;
$data->status;
$data->idSessao;
$data->dataHora;
print_r($data); //esse print contem todo conteudo
}
print_r($data); //esse print nao contem nada
$this->data = &$data;
return true;
}
In the other file where I get the data have this line:
$lista = $modelObj->data;
//aqui não tenho valor algum
Trecho que usa os dados de return
<?
$modelObj->Consulta();
$lista = $modelObj->var;
//esse print nao tem valor
print_r($lista);
?>
<div class="col200"><?=$lista['id'];?></div>
<div class="col100 center"><?=$lista['modelo'];?></div>
<div class="col100 center"><?=$lista['login'];?></div>
<div class="col100 center"><?=$lista['senha'];?></div>
<div class="col100 center"><?=$lista['cadin'];?></div>
<div class="col100 center"><?if($lista['status'] == 1){echo "Ativo";}else{echo "Desativado";};?></div>
<div class="col100 center"><?=$lista['idSessao'];?></div>
<div class="col100 center"><?=$lista['dataHora']?></div>
<div class="col100 center"></div>
<div class="clear"></div>