I have a table called sale and in this table I insert some data from another table until everything blz, my problem and at the time of showing this data when I do an echo on the screen does not appear the name of the product but yes his id and I need the name to appear, this and my code:
<?php
include("banco.php");
echo'<link rel="stylesheet" type="text/css" href="css/estilo.css">';
echo'<link rel="stylesheet" type="text/css" href="css/bootstrap.css">';
echo '<a href="vendas.php" style="color: #ffffff" class="btn btn-inverse">Cadastrar Vendas</a></br></br>';
include("banco.php");
$id = $_GET["id"];
$sql = mysql_query("select * from venda where id_venda='$id'");
$exibe = mysql_fetch_assoc($sql);
$perfil=mysql_query("SELECT * FROM venda WHERE id_venda='$id'");
$dados=list($id_venda,$venda,$data,$placa,$km,$produtos,$servicos)=mysql_fetch_row($perfil);
?>
<label for="nome" style="color: #000"><strong>ID DA VENDA :</strong> </label>
<input type="text" readonly="true" name="id" value="<?php echo $dados[0]; ?>">
<label for="nome"readonly="true" style="color: #000"><strong>Nº DA VENDA:</strong> </label>
<input type="text" name="id" readonly="true" value="<?php echo $dados[1]; ?>">
<div id="camp1">
<label for="nome" style="color: #000"><strong>DATA :</strong> </label>
<input type="text" name="id" readonly="true" value="<?php echo $dados[2]; ?>">
<label for="nome" style="color: #000"><strong>PLACA :</strong> </label>
<input type="text" name="id" readonly="true" value="<?php echo $dados[3]; ?>">
</div>
<div id="camp2">
<label for="nome" style="color: #000"><strong>KM :</strong> </label>
<input type="text" name="id" readonly="true" value="<?php echo $dados[4]; ?>">
<label for="nome" style="color: #000"><strong>PRODUTO :</strong> </label>
<input type="text" name="id" readonly="true" value="<?php echo $dados[5]; ?>">
</div>
<div id="camp3">
<label for="nome" style="color: #000"><strong>SERVIÇO :</strong> </label>
<input type="text" name="id" readonly="true" value="<?php echo $dados[6]; ?>">
</div>
I used the following code to do the id transformation for the name, but since I'm not listing the items does not work:
$produtos = "SELECT * FROM produtos WHERE id=". $dados['produtos'];
$query = mysql_query($produtos);
$b=mysql_fetch_array($query);
#$id = $b ['id'];
$produtos = $b ['produtos'];
Where Product and Service I would like to see the name and not the id: