I have the following query that brings the name of the recipe and the ingredients:
$query = ("
SELECT r.receita, i.ingrediente
FROM ptp_receitas r, ptp_receitas_ingredientes ri, ptp_ingredientes i
WHERE r.id = ri.idreceita
AND ri.idingrediente = i.id
AND r.id = ".$rid);
$db -> setQuery($query);
$results = $db -> loadObjectList();
foreach($results as $row){
echo '<h1>'.$row->receita.'</h1>';
echo '<h2>Lista de Ingredientes:</h2>';
echo $row->ingrediente;
}
The problem is that this way he repeats the recipe name on all ingredient lines, for example:
Receita de Arroz
arroz
Receita de Arroz
sal
I wanted you to come:
Receita de arroz
arroz
sal