How to display data from an array in a table in the vertical way

i want to creating table for seating arrangements of students according to roll nubmber
in this format(vertical)

Row 1  Row 2 Row 3 Row 4

a       e      i     m

b       f      j     n

c       g      k     o

d       h      l     p

where number of rows and colums of the table can be different depending on the variables $rows and $cols

    $sql= "SELECT rollno FROM student WHERE batch= '".mysqli_real_escape_string($con, $_POST['batch'])."'";
    $result = mysqli_query($con, $sql);

    if(!$result)
    {

        echo 'Something went wrong. Please try again';

    }
    else
    {
        while($resulrow = mysqli_fetch_assoc($result))
        {
            $array[]=$resultrow['rollno'];
        }   

Now i have $array[]which is having list of roll numbers of students.

I want to display these roll numbers in a table with vertical display and every row should display row number in the table head(top).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s