Retorno de descrição no nome da chave estrangeira

09/07/2019

0

Boa tarde, Pessoal!
Estou fazendo a seguinte pesquisa:
<?php
echo
"<table class=''tabela''>
<tr>
<th>CÓDIGO</th>
<th>VARIEDADE</th>
<th>PENEIRA</th>
<th>FORNECEDOR</th>
<th>OPÇÕES</th>
</tr>";

?>

<?php while ($row = mysqli_fetch_array($consulta)) {
echo "<tr>";
echo "<td>".$row[''idSoja'']."</td>";
echo "<td>".$row[''NomeSoja'']."</td>";
echo "<td>".$row[''PeneiraSoja'']."</td>";
echo "<td>".$row[''fornSoja'']."</td>";
echo "<td><a href=EditaCadCli.php?idCliente=.$row[idSoja] class =''tbtb''>Editar</a> |
<a href=ExcluiCadCli.php?idCliente=.$row[idSoja] class =''tbtb''>Excluir</a> |
<a href=Index.php class =''tbtb''>Cancelar</a>
</td> ";
echo "</tr>";
}
echo "</table>";

mysqli_close($conexao);
?>

a informação fornSoja é uma chave estrangeira gostaria de puxar a descrição do ao invés do código como está aparecendo para mim.


desde já muito obrigado
Aislan Santos

Aislan Santos

Responder

Posts

09/07/2019

Aislan Santos

o meu código inteiro pessoal

<?php

include_once("Conn.php");

$filtro = isset($_GET['filtro']) ? $_GET['filtro'] : "";

$sql = "select * from variedades where nomeSoja like'%$filtro%' order by nomeSoja";
$consulta = mysqli_query($conexao, $sql);
$registros = mysqli_num_rows($consulta);


?>

<!DOCTYPE HTML>
<html lang="pt-br">

<head>
<meta charset="UTF-8">
<title>Controle de Soja</title>
<!-- Aqui chamamos o nosso arquivo css externo -->
<link rel="stylesheet" href="../teste2/css/Pagina.css" />
<script type="text/javascript" src="..test2/js/tabela.js"></script>

<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
</head>

<body>
<header>
<h1>
<?php
include_once 'Topo.html';
?>
</h1>
</header>
<div>
<?php
include_once 'menu.html';
?>
</div>

<div class="containerPagina">
<nav class="navPagina">
<ul class="MenuLeft">
<a href="CadSoja.php">
<li>Cadastro</li>
</a>
<a href="consultaCadSoja.php">
<li>Consulta</li>
</a>
</ul>
</nav>


<section>

<h1>Consulta Variedades</h1>
<hr><br><br>

<form action="" method="get">
filtrar por nome: <input type="text" name="filtro" class="campo" required autofocus />
<input type="submit" value="Pesquisar" class="btn">
</form>



<?php
echo
"<table class='tabela'>
<tr>
<th>CÓDIGO</th>
<th>VARIEDADE</th>
<th>PENEIRA</th>
<th>FORNECEDOR</th>
<th>OPÇÕES</th>
</tr>";

?>

<?php while ($row = mysqli_fetch_array($consulta)) {
echo "<tr>";
echo "<td>".$row['idSoja']."</td>";
echo "<td>".$row['NomeSoja']."</td>";
echo "<td>".$row['PeneiraSoja']."</td>";
echo "<td>".$row['fornSoja']."</td>";
echo "<td><a href=EditaCadCli.php?idCliente=.$row[idSoja] class ='tbtb'>Editar</a> |
<a href=ExcluiCadCli.php?idCliente=.$row[idSoja] class ='tbtb'>Excluir</a> |
<a href=Index.php class ='tbtb'>Cancelar</a>
</td> ";
echo "</tr>";
}
echo "</table>";

mysqli_close($conexao);
?>

</section>



</div>


<footer>

</footer>
</body>

</html>
Responder

09/07/2019

Aislan Santos

pensei um pouco e resolvi o pulo do gato tava no select
Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar