Jump to content

change table orientation


jleinbaugh

Recommended Posts

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>");

 

}

Link to comment
https://forums.phpfreaks.com/topic/191815-change-table-orientation/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.