Based on the comment, to display columns in html dynamically you can use the function array_keys()
that returns the key names and with them do a second foreach to display the values.
$registros =[
['id' => 1, 'nome' => 'alberto'],
['id' => 2, 'nome' => 'beto'],
['id' => 3, 'nome' => 'carlos'],
];
foreach($registros as $item){
$campos = array_keys($item);
foreach($campos as $valor){
echo $item[$valor] .'<br>';
}
}
A more proactive example of reality would be the code below, it can be abstracted to function.
$query = mysql_query("select * from paineladm_usuarios") or die(mysql_error());
echo '<table border="1">';
while($row = mysql_fetch_assoc($query)){
$campos = array_keys($row);
echo '<tr>';
foreach($campos as $campo){
echo '<td>'. $row[$campo] .'</td>';
}
echo '</tr>';
}
echo '</table>';
I’d just put the asteric (
*
)?– rray