0
Well, I’m trying to select all items from two separate listings, but without success, I’m using:
Query
select t*, d.id as id_discvinculada from textos as t join disciplinas as d on t.id_discvinculada = d.id
Function
function listagemTextos($conexao){
$textos = array();
$resultado = mysqli_query($conexao, "select t*, d.nome_disciplina as id_discvinculada from textos as t join disciplinas as d on t.id_discvinculada = d.id");
while($texto = mysqli_fetch_assoc($resultado)){
array_push($textos, $texto);
}
return $textos;
}
Function call
<?php
$textos = listagemTextos($conexao);
foreach ($textos as $texto){
?>
<div>
<div>
<h4><?= $texto["titulo"] ?></h4>
<label><?= $texto["id_discvinculada"] ?></label>
<ul>
<span>Opções</span>
<li>Alterar</li>
<li><a href="logicas/logica-remover_texto.php?id=<?= $texto['id']?>">Remove</a></li>
</ul>
</div>
<div>
<?= $texto["texto"] ?>
</div>
</div>
<?php
}
Disciplines
Texts
Warning
Warning
: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, boolean given in
C:\xampp\htdocs\dev_port\historia\logicas\banco_textos.php
on line
7
As I add Foreign Key, and use it so I can display the items correctly in the function call ?
Apparently missed a point in your consultation on
t*
, right at the start. You can check the error using the functionmysqli_error
.– Woss