jleinbaugh Posted February 11, 2010 Share Posted February 11, 2010 Yes, I'm a noob and this is probably a simple question, but I can't figure it out. The following code creates a table that lists names across the top, dates along the left hand column, then fills in what roles, if any the individual plays on the date. What I would LIKE to do is change the orientation to have dates along the top and names along the left hand side. I can swap the top and left hand column easily enough, but can't for the life of me get past how to change the rest so the parts change orientation (having parts associated along the horizontal instead of vertical) Is this easy? what am I missing? // Create Table for Viewing Schedule echo("<table border=2 cellspacing=0>"); echo("<tr><th>Date/Name</th>\n"); for($i=0;$i<$num_Name_results;$i++){ echo("<th width=100>".$name[$i]."</th>\n"); } echo("</tr>\n"); for($i=0;$i<$num_date_results;$i++){ $dateday = date('D', strtotime($date[$i])); echo("<tr><th>$dateday ".date_convert($date[$i],3)."</th>\n"); for($j=0; $j<$num_Name_results; $j++){ $query = "SELECT Part FROM $SchedDates WHERE UID='".$userID[$j]."' AND Date='".$date[$i]."'"; $result = mysql_query($query); $row=mysql_fetch_array($result); $part = $row["Part"]; if(!$part)$part = " "; echo("<td align='center' "); if(mysql_num_rows($result)==0)echo("bgcolor='#888888'"); echo(">".$part."</td>\n"); } echo("</tr>\n"); } echo("</table>"); } Quote Link to comment https://forums.phpfreaks.com/topic/191815-change-table-orientation/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.