raj76 Posted February 2, 2010 Share Posted February 2, 2010 Hi All, I am trying to achieve a table like this timeslots User1 User2 User3 User4 8am-9am work work work work 9-10 10-11 ... ... ... 17-18 What I have done so far: $sql=mysql_query("select * from report,admin_table where report.admin_id=admin_table.admin_id and which_day='".date('Y-m-d')."'") or die(mysql_error()); while($row=mysql_fetch_array($sql)) { $admin_name=$row['admin_name']; $activity=$row['activity']; $start_time=$row['start_time']; $end_time=$row['end_time']; $time=$start_time." ".$end_time; $total_value=$row['total_value']; $test_array[$admin_name][$activity][$time] = $total_value; } echo '<pre>'; print_r($test_array); echo '</pre>'; It gives me the outout like Array ( [az] => Array ( [dsdsds] => Array ( [2010-02-02 2:47 PM 2010-02-02 2:55 PM] => 8 ) ) [an] => Array ( [sdsdsdsdsd] => Array ( [2010-02-02 1:47 PM 2010-02-02 2:47 PM] => 60 ) ) [mu] => Array ( [sdsdsd] => Array ( [2010-02-02 1:30 PM 2010-02-02 2:48 PM] => 78 ) ) [raj] => Array ( [dsdwew] => Array ( [2010-02-02 3:34 PM 2010-02-02 3:40 PM] => 6 ) [cdsfdfdfd] => Array ( [2010-02-02 3:25 PM 2010-02-02 3:35 PM] => 10 ) ) ) Could you please tell me how can I display the array data like the html table i have displayed above. Please suggest...Thanks in advance. Raj Link to comment https://forums.phpfreaks.com/topic/190676-multidimensional-array-to-html-tableplz-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.