Help Returning Errors - Warning: Illegal string offset 'id'

0
define("HOST","localhost");
define("DB_USER","root");
define("DB_PASS","");
define("DB_NAME","cc_cond");


$conn = mysqli_connect(HOST,DB_USER,DB_PASS,DB_NAME);
ini_set('display_errors', 1);
if(!$conn)
{
    die(mysqli_error());
}


function listar($tabela, $campos="*", $onde=null, $filtro=null, $ordem=null, 
$limite=null) {

global $conn;

$query = "SELECT $campos FROM $tabela";

if ($onde) {            
    $query .= " WHERE $onde";       
}       
elseif ($filtro) {          
    $query .= " WHERE $filtro";     
}

if ($ordem) {           
    $query .= " ORDER BY $ordem";       
}

if ($limite) {      
    $query .= " LIMIT $limite"; 
}

$rs = mysqli_query($conn,$query);

$row = mysqli_fetch_assoc($rs);
$new_array[] = $row;            
return $row;

}

<?php $listagem = listar('sistema'); ?>
   <?php foreach ($listagem as $listar): ?>
   <tr><?php var_dump($listar);?>
   <td><?php echo $listar['id']; ?></td>
   <td><?php echo $listar['cd_sis']; ?></td>
   <td><?php echo $listar['cd_temp']; ?></td>                        
   <td></td>
 <?php  endforeach; ?>
   </tr>

 DUMP!!! Erros -> erros de retorno![![inserir a descrição da imagem aqui][1]][1]
 /var/www/server/projeto-condominio/data/condominio.php:188:string '1' 
 (length=1)
 ERROS ->  Warning: Illegal string offset 'id' in /var/www/server

ERROR return -

  

1 1 R R 4 4 c c T T 0 0 h h 1 1 1 1 C C 1 1 R R P P 4 4 S S T T 1 1 0   0 what I get instead of recer id 1 name id 2 another name

    
asked by anonymous 21.10.2018 / 03:38

0 answers