I'm using a while loop in order to display items from the database but this instead is displaying the same result and ignoring one. Example: if the first items is called Item1 and I have 4 items in the database (Item1, Item2, Item3, Item4) it will display 3 times the Item1.
<?php
$card_data = mysqli_query($con, "SELECT * FROM builds");
$card_data_result = mysqli_fetch_array($card_data);
$build_name = $card_data_result['build_name'];
while ($card_data_result = mysqli_fetch_array($card_data)){
echo "$build_name";
}
?>
Any ideas how to fix it?
$buildnamevariable in the while loop.$build_name, which gets assigned outside thewhileloop. Try printing$card_data_result['build_name']instead.