I joined two tables successfully but I can't figure out how to condition a variable that repeats.
$kelo = "SELECT e.id, e.rosary, e.group_name, e.description, u.group_id, u.name, u.decade, u.intention, u.datume FROM `rosary_group_name` AS e INNER JOIN `rosary_groups` AS u ON e.id = u.group_id ORDER BY e.id DESC, u.group_id DESC;";
$melo = mysqli_query($con,$kelo);
while($row = mysqli_fetch_array($melo)){
echo '<div style="clear:left;">' .$row['rosary']. " - ". $row['name'].'</div>';
echo "<br />";
}
Display is :
JOJO - hello1
JOJO - hello2
JOJO - hello3
PAJO - hi1
PAJO - hi2
KAJO - Cheers1
KAJO - Cheers2
KAJO - Cheers3
but I need:
JOJO - hello1
hello2
hello3
PAJO - hi1
hi2
KAJO - Cheers1
Cheers2
Cheers3
how do I achieve that?