Я ищу способ отображения:
<h1>State1</h1>
<h2>City1</h2>
<p>Address1</p>
***if next address is in the same state:*
<h2>City2</h2>
<p>Address2</p>
<hr>
**if next address is NOT in the same state
<h1>State2</h1>
<h2>City3</h2>
<p>Address3</p>
Я использую:
<?php
$query = "SELECT * FROM places";
$select_all_places = mysqli_query($connection, $query);
while($row = mysqli_fetch_assoc()){
$p_state = $row['p_state'];
$p_city = $row['p_city'];
$p_address = $row['p_address'];
?>
<h1><?php echo $p_state ?></h1>
<h2><?php echo $p_city ?></h2>
<p><?php echo $p_address ?></p>
<?php } ?>