I've looked around for this and have found nothing.
<?php
$viewCurrentFlightsQuery = $db->prepare("SELECT id, planet_1, planet_2 FROM flights WHERE universe = :universe AND company = :company");
$viewCurrentFlightsQuery->bindParam(":universe", $universe);
$viewCurrentFlightsQuery->bindParam(":company", $airlineNameGet);
$viewCurrentFlightsQuery->execute();
$viewCurrentFlights = $viewCurrentFlightsQuery->fetchAll();
echo "You currently have <strong>".$currentFlightsNumber."</strong> active flights!<br><br>";
foreach($viewCurrentFlights as $row){
$selected = $row["id"];
echo '<tr>';
echo '<td class="table">'.$row["planet_1"].'</td><td class="table">'.$row["planet_2"].'</td>';
?>
<td class="table"><form method="post" action="create.php"><input type="hidden" name="selected" value="<?php echo $selected;?>"><button type="submit">View Detail</button> </form></td>
<?php
echo '</tr>';
}
echo "</table><br>";
Essentially what I want is only to display each element if the column planet_1 or planet_2 are different. However, on top of this they should be interchangeable - so if planet_1 is X and planet_2 is Y, then if planet_1 is Y and planet_2 is X they will not be shown twice by the foreach loop. I'm not even sure if this is possible.
Xto be repeated several times underplanet_1in your output?