Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.