I created this function, but, it returns only the first record of the table.
function pega_conteudo_pela_id($id_assunto){
global $conexao;
$query3 = "SELECT * FROM '{$id_assunto}'";
$result3 = mysqli_query($conexao,$query3) or die("MySQL error: " . mysqli_error($conexao) . "<hr>\nQuery: $query3");
while ($leiDB = mysqli_fetch_array($result3)) {
return utf8_encode($leiDB['conteudo']. "<br/>");
}
}
But if I put it on the links page, it works and takes all the records
case 'codigo-civil':
$query3 = "SELECT * FROM 'codigo-civil'";
$result3 = mysqli_query($conexao,$query3);
while ($leiDB = mysqli_fetch_array($result3)) {
echo utf8_encode($leiDB['conteudo']. "<br/>");
}
break;