0
I have this code and do not know why I return only the first character of the variable(exe: if the login contains the value Diego, print only D) The print_r that is there,I put to test the return all the information I need is there in the array.
I apologize if it wasn’t the most elaborate question.
<table border="1">
<tr>
<td>idSessao</td>
<td>Modelo</td>
</tr>
<?php
$idSessao = $_SESSION['login']['uid'];
$modelObj->get_dados_venda_club($idSessao);
$lista = $modelObj->data;
print_r($lista);
if(!isset($lista)){
foreach ($lista as $key => $listas) {
?>
<tr>
<td><?php echo $listas['idSessao']?></td>
<td><?php echo $listas['modelo']?></td>
</tr>
<?php
}
}else{
echo "não existe retorno ".$listas;
}
?>
</table>
// return with var_dump
array(7) { ["id"]=> string(2) "13" ["model"]=> string(4) "1564" ["login"]=> string(28) "do idea what enters here" ["password"]=> string(8) "88274574" ["Cadin"]=> string(10) "1459800190" ["status"]=> string(1) "1" ["idSessao"]=> string(1) "1" }
Asks the array structure
– rray
To make it clearer, you could run a
var_dump($lista)
and post the result here. So it will be easier to help.– Whatyson Neves
Maybe in the database you did not set the size of the string, so you may only be saving the first letter. Or the type, for example, char or varchar.
– David Damasceno