Just a quick note, I understand my PHP code is messy and I know I could fix a lot of it with an array.
So this page is used to display vehicle details that are stored in multiple tables, the record will either equal 1 or 2. 1 being Yes it has this feature and 2 being no it doesn't. Then in my styling later on I check IF it equals 1 and if it does, then display some text so the user can see what features the vehicle has. My styling prints a little blue tick next to the text just to look nice. It only prints this tick if the vehicle has a feature, but for some reason it's printing the tick randomly. It doesn't match either, so in my code if there is 5 things the vehicle doesn't have then it might only print 1 blank tick or 2, it's not consistent and I can't figure out why!
Initial PHP Code
//Fetch Category - Most Popular
$queryThree = "SELECT * FROM categoryMostPopular WHERE vehicleReg = :reg";
$stmt = $conn->prepare($queryThree);
$stmt->bindValue(':reg', $vehicleReg);
$stmt->execute();
$category1 = $stmt->fetch(PDO::FETCH_ASSOC);
//Put Results Into Variables
$mostPopularReg = $category1['vehicleReg'];
$airCon = $category1['airCon'];
$bluetooth = $category1['bluetooth'];
$climateControl = $category1['climateControl'];
$satNav = $category1['satNav'];
$commsPack = $category1['commsPack'];
$climateZonex2 = $category1['climateZonex2'];
$dvdPlayer = $category1['dvdPlayer'];
$fullLeather = $category1['fullleather'];
$halfLeather = $category1['halfLeather'];
$ipodConnectivity = $category1['ipodConnectivity'];
$manufacturersDirect = $category1['manufacturersDirect'];
$memorySeats = $category1['memorySeats'];
$panarRoof = $category1['panarRoof'];
$elecFoldingMirrors = $category1['elecFoldingMirrors'];
$rainSenseWipers = $category1['rainSenseWipers'];
$xenonHeadlights = $category1['xenonHeadlights'];
I haven't posted all the Initial PHP code mainly because i've got 12 categories the same as the above, so it would be a lot of code.
Check IF variable is set to 1 or 2, then display tick and text
<div class="col-sm-6">
<ul class="fa-ul list-unstyled">
<?php
if ($alcantaraLeather == 1) { echo "<li><i class='fa-li fa fa-check'></i>Alcantara Leather</li>"; }
if ($clothUpholstery == 1) { echo "<li><i class='fa-li fa fa-check'></i>Cloth Upholstery</li>"; }
if ($velourTrim == 1) { echo "<li><i class='fa-li fa fa-check'></i>Velour Trim</li>"; }
if ($fullLeather == 1) { echo "<li><i class='fa-li fa fa-check'></i>Full Leather</li>"; }
if ($halfLeather == 1) { echo "<li><i class='fa-li fa fa-check'></i>Half Leather</li>"; }
if ($elecFoldingMirrors == 1) { echo "<li><i class='fa-li fa fa-check'></i>Electric Folding Mirrors</li>"; }
if ($rainSenseWipers == 1) { echo "<li><i class='fa-li fa fa-check'></i>Rain Sense Wipers</li>"; }
if ($xenonHeadlights == 1) { echo "<li><i class='fa-li fa fa-check'></i>Xenon Headlights</li>"; }
if ($electricSeats == 1) { echo "<li><i class='fa-li fa fa-check'></i><li><i class='fa-li fa fa-check'></i>Electric Seats</li>"; }
if ($frontCentreArmrest == 1) { echo "<li><i class='fa-li fa fa-check'></i><li><i class='fa-li fa fa-check'></i>Front Centre Armrest</li>"; }
if ($headRestraints == 1) { echo "<li><i class='fa-li fa fa-check'></i><li><i class='fa-li fa fa-check'></i>Head Restraints</li>"; }
if ($heatedSeats == 1) { echo "<li><i class='fa-li fa fa-check'></i><li><i class='fa-li fa fa-check'></i>Heated Seats</li>"; }
?>
</ul>
</div> <!-- end .col-sm-6 -->
I'd really appreciate it if someone can have a look and see why the random ticks are appearing.
After making adjustments to the code, as mentioned by another user. This is my result