JohnPaulDesign
11/25/2016 - 2:03 PM

Pull data from database and repeat it

Pull data from database and repeat it

<?php

    //select all data from the categories table of the db
    
    $query = "SELECT * FROM categories";
    $select_all_categories = mysqli_query($connection, $query);
    
    //fetch and repeat data from the cat_title row with a while loop
    
    while($row = mysqli_fetch_assoc($select_all_categories)) {

        $cat_title = $row['cat_title'];

        echo "<li><a href=''>{$cat_title}</a></li>";
    }
?>