How do I make this in PHP Array and MySQL?

Here is my code

<table class="table table-bordered table-striped table-hover" id="tblSchedule">
    <thead>
        <tr>
            <?php
                $days=array("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
                for ($i=0;$i<COUNT($days);$i++) { 
                    echo "<th>".$days[$i]."</th>";
                }
            ?>
        </tr>
    </thead>
    <tbody>
       <?php
            $days=array("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
            echo "<tr>";
            for ($x=0;$x<COUNT($days);$x++) { 
                $get_schedule=getData("SELECT * FROM acadsoc_class_schedule WHERE class_day=? AND username=?",array($days[$x],$_SESSION['username']));
                foreach ($get_schedule as $schedule) {
                    echo "<tr>";
                        echo "<td>".$schedule->class_time."</td>";
                    echo "</tr>";
                }
            }
            echo "</tr>";
        ?> 
    </tbody>
</table>

Not really sure what you’re asking. You’re asking about making an array, but your code is creating an HTML table.

Yeah, making an array to create a HTML Table

#1: Only do one query, instead of looping it. You’re already using the dreaded SELECT *, so you’re getting the information back anyway.

#2: You can’t make an unbalanced table this way. You’d need to create new tables in each of the columns, or start generating blank cells in the unmatched rows, for which you’d have to know the results of the query ahead of time (see #1).

The same or equivalent topic seems to be discussed already in your other thread:
How do I make this scheduler in PHP and MySQL?

Closing this thread in order to not split the discussion further.