Array data to display in table cells where col and row are given in array
Posted
by
Saleem
on Stack Overflow
See other posts from Stack Overflow
or by Saleem
Published on 2012-10-16T10:24:36Z
Indexed on
2012/10/16
11:01 UTC
Read the original article
Hit count: 277
I have a array
Array (
Array (
[id] => 1 ,
[schedule_id] => 4 ,
[subject] => Subject 1 ,
[classroom] => 1 ,
[time] => 08:00:00 ,
[col] => 1 ,
[row] => 1
),
Array (
[id] => 2 ,
[schedule_id] => 4 ,
[subject] => Subject 2 ,
[classroom] => 1 ,
[time] => 08:00:00 ,
[col] => 2 ,
[row] => 1
),
Array (
[id] => 3 ,
[schedule_id] => 4 ,
[subject] => Subject 3 ,
[classroom] => 2 ,
[time] => 09:00:00 ,
[col] => 1 ,
[row] => 2
),
Array (
[id] => 4 ,
[schedule_id] => 4 ,
[subject] => Subject 4 ,
[classroom] => 2 ,
[time] => 09:00:00 ,
[col] => 2 ,
[row] => 2
)
)
I want to display it in table format according to col and row value
col 1 & row 1 col 2 $ row 1
1st array data 2nd array data
Subject, room, time Subject, room, time
1, 1, 08:00 2, 1, 08:00
col 1 $ row 2 col 2 $ row 2
3rd array data 4th array data
Subject, room, time Subject, room, time
3, 2, 09:00 4, 2, 08:00
I am new to arrays and need you support to sort this table. Thanks
© Stack Overflow or respective owner