I am working on job portal project, and want to arrange values alphabetically according to their starting alphabet section, I want companies starting with A to be under the A column header, and companies starting with B to be under the B header..." or if i have no companies with the value of B then B be skipped.
<span>a</span>
<?php
$sql = "select * from companies";
$result = mysqli_query($con, $sql);
while($data = mysqli_fetch_array($result)) {
$company = $data['company_name'];
?>
<div class="list-col"> <a href="#"><?php echo $company; ?>(0)</a> </div>
<?php
}
?>
</div>
</li>
<!-- Sample of how column in HTML -->
<li class="loop-entry">
<div class="col">
<span>C</span>
<div class="list-col">
<a href="#">Company Name (0)</a>
<a href="#">Company Name (1)</a>
<a href="#">Company Name (2)</a>
<a href="#">Company Name (3)</a>
<a href="#">Company Name (4)</a>
</div>
</div>
</li>
i wants to arrange according to this image