I have the following problem: I have a table named pedido
. In this table I get data from two other tables:
I'dliketomakealistofonlyproductsthathavethesameid_venda
.Inmycodeonlythefirstitemaddedwithequalidappears:
<?php$perfil1=mysql_query("SELECT * FROM pedido WHERE id_venda='$id'");
$lista=list($id, $produtosb , $idvenda)=mysql_fetch_row($perfil1);
$prod = "SELECT * FROM produtos WHERE id_produto=". $lista[1];
$query = mysql_query($prod);
$b=mysql_fetch_array($query);
$prod = $b ['produtos'];
?>
<input type="text" name="id" style="width: 450px" readonly="true" value="<?php echo $prod; ?>"><br>
I tried to use the while loop, but it returns all the data in the table. What repetition loop should I use?