Jump to content

Split tables into half and then into half again using row count


Rob (SA)

Recommended Posts

Hi folks,We have created tables that can be veiwed at this linkI would now like to split eacvh table in half by row count and then again by the new row count - that is th etable will be split into four.Following this I would like to insert a row which has the members name as "STARTER"Any ideas here would be welcome

Link to comment
Share on other sites

I came up with this, i was waiting for question in verifying application.instead dividing rows, it group players in rows of four, split in middle by starter row, this is based on spreadsheet layout. I did ask if there would be more than 2 rows above, and below the starter rowsas in total of 24 row table, divided by 2 = 12, divided again = 6, is it acceptable to have 3 rows above, and below the starter row?

<?phpmysql_select_db($database_golfconn, $golfconn);$quey1 = "SELECT * FROM tournaments ORDER BY i_wish_to_play, my_handicap_is DESC";$result = mysql_query($quey1, $golfconn) or die(mysql_error());$total_col=4;$starterrow = 2;if(isset($_POST['columnselect'])){$total_col=$_POST['columnselect'];}		  $col_colunt=0;	  $currentclub="";	  $trcount=0;	$trgroup=0;	  $trclass="";	function fillemptygrouprows($trgroup,$total_col){if($trgroup<4)		{		for($r=$trgroup;$r<4;$r++)		{			if($r %2 == 0)				{				echo '<tr class="starter"><td>  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td class="fullname">STARTER</td><td class="hcap"> </td>';					}			echo '</tr>';				}				echo '<tr><td class="time">  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td> </td><td> </td>';					}			echo '</tr>';			}		}}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script type="text/javascript">/*<![CDATA[*//*---->*//*--*//*]]>*/</script> <style type="text/css">table {border:2px solid #D3E2FE;  width:100%;  font-size:12px;  font-family:Arial; color:#00008B;margin-bottom:20px;}table tr td {border-right:1px solid #D3E2FE;border-top:1px solid #D3E2FE;}tr.header{background-color:#D6D6D8; font-weight:bold;}.rowcol1 {background-color:#F0FFFF;}.rowcol2 {background-color:#FFFFF0;}td.fullname { padding-left:2px; font-size: 11px;}tr.header td.fullname{width:<?php echo 78/$total_col; ?>%; }tr.header td.hcap{width:<?php echo 16/$total_col; ?>%;}td.hcap {text-align:center;}#wrapper {width:85%; margin:0 auto;}.starter {background-color:#D3E2FE;text-align:center}.time {text-align:center}.blank {background-color:#FFF; }.blank td { border-width:0;}.bordertop td {border-top:1px solid #D3E2FE;}</style></head><body><div id="wrapper"><div id="form_container" style="width:300px; border:2px solid #D3E2FE; margin: 20px auto; text-align:center;"><h4>Column Number Selection:</h4><form action="" method="post" name="tablecontroller" target="_self"><select name="columnselect"><?phpfor($j=2;$j<7;$j++){if($total_col == $j){echo '<option value="'.$j.'" selected="selected">'.($j*2).' Column</option>';}else{echo '<option value="'.$j.'">'.($j*2).' Column</option>';}}?></select><div style="margin:20px; text-align:center; "><input name="colsubmit" type="submit" value="Submit" /></div></form></div><?php $result = mysql_query($quey1, $golfconn) or die(mysql_error());	$current_table_count=-1;while ($row = mysql_fetch_assoc($result)) 	{ 	  if($currentclub != $row['i_wish_to_play']  )		  {		$current_table_count++;						   if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells			   {			   for($i=$col_count;$i<$total_col;$i++)				   {				   echo "<td> </td><td> </td>";				   }			  echo "</tr>";			fillemptygrouprows($trgroup,$total_col);				echo "</table>";				  $trcount=0;						  }		 else if ($currentclub !="")			 {			fillemptygrouprows($trgroup,$total_col);						   echo "</table> ";			$trcount=0;			}  ?><table border="0" cellpadding="0" cellspacing="0">  <tr>  <th colspan="<?php echo ($total_col*2)+1; ?>"><?php echo $row['i_wish_to_play']; ?></th>  </tr>  <?php			  echo '<tr class="blank'.$bordtop.'"><td> </td>';				for ($i=0;$i<$total_col;$i++)					{					if($i == 0)						{						echo '<td style="font-weight:bold; text-align:center;"> TEE</td><td> </td>';						}					else						{						echo '<td> </td><td> </td>';						}								}			echo '</tr>';	?>  <tr class="header"><td style="width:40px; text-align: center;">TIME</td><?php		for ($i=0;$i<$total_col;$i++)			{			echo '<td class="fullname">FULL NAME</td><td class="hcap">H/CAP</td>';			}			?>	</tr><?php		$col_count=0;			}		if($col_count==0)			  {						if($trcount %$starterrow == 2 && $trcount !=0)				{				echo '<tr class="starter"><td>  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td class="fullname">STARTER</td><td class="hcap"> </td>';					}			echo '</tr>';				}				else				{				$starterrow=4;				if($trcount %2 == 0 && $trcount !=0)				{				$trgroup=0;				for($j=0;$j<2;$j++)				{				if($j==0)				{				$bordtop=" bordertop";				}				else				{				$bordtop="";				}								 echo '<tr class="blank'.$bordtop.'"><td> </td>';				for ($i=0;$i<$total_col;$i++)					{					if($i == 0 && $j !=0)						{						echo '<td style="font-weight:bold; text-align:center;"> TEE</td><td> </td>';						}					else						{						echo '<td> </td><td> </td>';						}								}			echo '</tr>';			}			}				}		echo '<tr><td class="time">  :  </td>';		$trcount++;		$trgroup++;			  }  	  if($col_count % 2 == 0)		   {		$trclass="rowcol1";		}	else		{		$trclass="rowcol2";		}  ?>		  <td class="fullname <?php echo $trclass; ?>"><?php echo strtoupper($row['name']); ?>, <?php echo strtoupper($row['surname']); ?></td>		<td class="hcap <?php echo $trclass; ?>"><?php echo $row['my_handicap_is']; ?></td><?php  		  $col_count++;		   if($col_count==$total_col)			  {			  echo "</tr>";			  $col_count=0;			  } 			$currentclub = $row['i_wish_to_play'];	   }//end while loop          if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells		   {		   for($i=$col_count;$i<$total_col;$i++)			   {			   echo "<td> </td><td> </td>";			   }		   echo "</tr>";		}		fillemptygrouprows($trgroup,$total_col);		?></table></div></body></html>

Link to comment
Share on other sites

Hi,Thanks for the prompt response - sorry if I missed your enquiry.The idea is to split what ever the table is into quartiles of roughly equal size - this will thus mean that each side of the field / course is balanced and they wont play into each other.In splittin git in half the tow halves would be name with a title (First TEE)(Tenth TEE)In the split thereafte (the example of the 6th row) the names would be filled with the word STARTER thus building some float into my field of players - this though would not appear as a complete break and the statrer would have a time allocation

I came up with this, i was waiting for question in verifying application.instead dividing rows, it group players in rows of four, split in middle by starter row, this is based on spreadsheet layout. I did ask if there would be more than 2 rows above, and below the starter rowsas in total of 24 row table, divided by 2 = 12, divided again = 6, is it acceptable to have 3 rows above, and below the starter row?
<?phpmysql_select_db($database_golfconn, $golfconn);$quey1 = "SELECT * FROM tournaments ORDER BY i_wish_to_play, my_handicap_is DESC";$result = mysql_query($quey1, $golfconn) or die(mysql_error());$total_col=4;$starterrow = 2;if(isset($_POST['columnselect'])){$total_col=$_POST['columnselect'];}		  $col_colunt=0;	  $currentclub="";	  $trcount=0;	$trgroup=0;	  $trclass="";	function fillemptygrouprows($trgroup,$total_col){if($trgroup<4)		{		for($r=$trgroup;$r<4;$r++)		{			if($r %2 == 0)				{				echo '<tr class="starter"><td>  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td class="fullname">STARTER</td><td class="hcap"> </td>';					}			echo '</tr>';				}				echo '<tr><td class="time">  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td> </td><td> </td>';					}			echo '</tr>';			}		}}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script type="text/javascript">/*<![CDATA[*//*---->*//*--*//*]]>*/</script> <style type="text/css">table {border:2px solid #D3E2FE;  width:100%;  font-size:12px;  font-family:Arial; color:#00008B;margin-bottom:20px;}table tr td {border-right:1px solid #D3E2FE;border-top:1px solid #D3E2FE;}tr.header{background-color:#D6D6D8; font-weight:bold;}.rowcol1 {background-color:#F0FFFF;}.rowcol2 {background-color:#FFFFF0;}td.fullname { padding-left:2px; font-size: 11px;}tr.header td.fullname{width:<?php echo 78/$total_col; ?>%; }tr.header td.hcap{width:<?php echo 16/$total_col; ?>%;}td.hcap {text-align:center;}#wrapper {width:85%; margin:0 auto;}.starter {background-color:#D3E2FE;text-align:center}.time {text-align:center}.blank {background-color:#FFF; }.blank td { border-width:0;}.bordertop td {border-top:1px solid #D3E2FE;}</style></head><body><div id="wrapper"><div id="form_container" style="width:300px; border:2px solid #D3E2FE; margin: 20px auto; text-align:center;"><h4>Column Number Selection:</h4><form action="" method="post" name="tablecontroller" target="_self"><select name="columnselect"><?phpfor($j=2;$j<7;$j++){if($total_col == $j){echo '<option value="'.$j.'" selected="selected">'.($j*2).' Column</option>';}else{echo '<option value="'.$j.'">'.($j*2).' Column</option>';}}?></select><div style="margin:20px; text-align:center; "><input name="colsubmit" type="submit" value="Submit" /></div></form></div><?php $result = mysql_query($quey1, $golfconn) or die(mysql_error());	$current_table_count=-1;while ($row = mysql_fetch_assoc($result)) 	{ 	  if($currentclub != $row['i_wish_to_play']  )		  {		$current_table_count++;						   if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells			   {			   for($i=$col_count;$i<$total_col;$i++)				   {				   echo "<td> </td><td> </td>";				   }			  echo "</tr>";			fillemptygrouprows($trgroup,$total_col);				echo "</table>";				  $trcount=0;						  }		 else if ($currentclub !="")			 {			fillemptygrouprows($trgroup,$total_col);						   echo "</table> ";			$trcount=0;			}  ?><table border="0" cellpadding="0" cellspacing="0">  <tr>  <th colspan="<?php echo ($total_col*2)+1; ?>"><?php echo $row['i_wish_to_play']; ?></th>  </tr>  <?php			  echo '<tr class="blank'.$bordtop.'"><td> </td>';				for ($i=0;$i<$total_col;$i++)					{					if($i == 0)						{						echo '<td style="font-weight:bold; text-align:center;"> TEE</td><td> </td>';						}					else						{						echo '<td> </td><td> </td>';						}								}			echo '</tr>';	?>  <tr class="header"><td style="width:40px; text-align: center;">TIME</td><?php		for ($i=0;$i<$total_col;$i++)			{			echo '<td class="fullname">FULL NAME</td><td class="hcap">H/CAP</td>';			}			?>	</tr><?php		$col_count=0;			}		if($col_count==0)			  {						if($trcount %$starterrow == 2 && $trcount !=0)				{				echo '<tr class="starter"><td>  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td class="fullname">STARTER</td><td class="hcap"> </td>';					}			echo '</tr>';				}				else				{				$starterrow=4;				if($trcount %2 == 0 && $trcount !=0)				{				$trgroup=0;				for($j=0;$j<2;$j++)				{				if($j==0)				{				$bordtop=" bordertop";				}				else				{				$bordtop="";				}								 echo '<tr class="blank'.$bordtop.'"><td> </td>';				for ($i=0;$i<$total_col;$i++)					{					if($i == 0 && $j !=0)						{						echo '<td style="font-weight:bold; text-align:center;"> TEE</td><td> </td>';						}					else						{						echo '<td> </td><td> </td>';						}								}			echo '</tr>';			}			}				}		echo '<tr><td class="time">  :  </td>';		$trcount++;		$trgroup++;			  }  	  if($col_count % 2 == 0)		   {		$trclass="rowcol1";		}	else		{		$trclass="rowcol2";		}  ?>		  <td class="fullname <?php echo $trclass; ?>"><?php echo strtoupper($row['name']); ?>, <?php echo strtoupper($row['surname']); ?></td>		<td class="hcap <?php echo $trclass; ?>"><?php echo $row['my_handicap_is']; ?></td><?php  		  $col_count++;		   if($col_count==$total_col)			  {			  echo "</tr>";			  $col_count=0;			  } 			$currentclub = $row['i_wish_to_play'];	   }//end while loop          if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells		   {		   for($i=$col_count;$i<$total_col;$i++)			   {			   echo "<td> </td><td> </td>";			   }		   echo "</tr>";		}		fillemptygrouprows($trgroup,$total_col);		?></table></div></body></html>

Link to comment
Share on other sites

Hi,Published the code and it can be veiwed at this linkThe selection of the columns is similar to what I had previous in mind when veiwing this site. I only want adminitrators to effect the choice of 2'3 or 4 players per team and hence that must be on a seperate page.Check this pageIf you select draw a pop up occurs with various choices and the the draw presented in the iframe.

Hi,Thanks for the prompt response - sorry if I missed your enquiry.The idea is to split what ever the table is into quartiles of roughly equal size - this will thus mean that each side of the field / course is balanced and they wont play into each other.In splittin git in half the tow halves would be name with a title (First TEE)(Tenth TEE)In the split thereafte (the example of the 6th row) the names would be filled with the word STARTER thus building some float into my field of players - this though would not appear as a complete break and the statrer would have a time allocation
Link to comment
Share on other sites

sorry you need to replace table connection, and table reference to you ownmysql_select_db($database_golfconn, $golfconn);change$quey1 = "SELECT * FROM tournaments ORDER BY i_wish_to_play, my_handicap_is DESC";to$quey1 = "SELECT * FROM _Form_Nr_3 ORDER BY i_wish_to_play, my_handicap_is DESC";

Link to comment
Share on other sites

This link gives a good example of the ideal finished product

Hi,Published the code and it can be veiwed at this linkThe selection of the columns is similar to what I had previous in mind when veiwing this site. I only want adminitrators to effect the choice of 2'3 or 4 players per team and hence that must be on a seperate page.Check this pageIf you select draw a pop up occurs with various choices and the the draw presented in the iframe.
Link to comment
Share on other sites

Getting there - dropping a few names though.To also improve what we have there will never be more than 4 players playing together and there will never be less than two.The maximume size of the field would be 60 per side i.e 120 in a field

Same result
Link to comment
Share on other sites

I got this part sorted I saw lower down in the code that this line was repeated an dI had not changed it there.Changed now and it is giving an improved result.We only have two starters rows per event with one row per Tee

OK! try thischange$result = mysql_query($quey1, $golfconn) or die(mysql_error());to$result=mysql_query($quey1) or die(mysql_error());
Link to comment
Share on other sites

We only have two starters rows per event with one row per Tee
OK!.... no actually, im totally confused now! try below code. please do a printscreen (prt sc button), paste image into a image editor, and adjust it to the layout you expect.
<?php$quey1 = "SELECT * FROM _Form_Nr_3 ORDER BY i_wish_to_play, my_handicap_is DESC";$result = mysql_query($quey1) or die(mysql_error());$total_col=4;$starterrow = 2;if(isset($_POST['clubselect'])){$clubselected=$_POST['clubselect'];}else{while ($row = mysql_fetch_assoc($result)) 	{ 	$clubselected=$row['i_wish_to_play'];	break;	}}	  $col_colunt=0;	  $currentclub="";	  $trcount=0;	$trgroup=0;	  $trclass="";	function fillemptygrouprows($trgroup,$total_col){if($trgroup<4 && $trgroup>0)		{		for($r=$trgroup;$r<4;$r++)		{			if($r %2 == 0)				{				echo '<tr class="starter"><td>  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td class="fullname">STARTER</td><td class="hcap"> </td>';					}			echo '</tr>';				}				echo '<tr><td class="time">  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td> </td><td> </td>';					}			echo '</tr>';			}		}}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script type="text/javascript">/*<![CDATA[*//*---->*//*--*//*]]>*/</script> <style type="text/css">table {border:2px solid #D3E2FE;  width:100%;  font-size:12px;  font-family:Arial; color:#00008B;margin-bottom:20px;}table tr td {border-right:1px solid #D3E2FE;border-top:1px solid #D3E2FE;}tr.header{background-color:#D6D6D8; font-weight:bold;}.rowcol1 {background-color:#F0FFFF;}.rowcol2 {background-color:#FFFFF0;}td.fullname { padding-left:2px; font-size: 11px;}tr.header td.fullname{width:<?php echo 78/$total_col; ?>%; }tr.header td.hcap{width:<?php echo 16/$total_col; ?>%;}td.hcap {text-align:center;}#wrapper {width:95%; margin:0 auto;}.starter {background-color:#D3E2FE;text-align:center}.time {text-align:center}.blank {background-color:#FFF; }.blank td { border-width:0;}.bordertop td {border-top:1px solid #D3E2FE;}.teeinput_outer {margin-top:10px;}.teeinput_outer div span { display:block;float:left;width:160px;margin-left:10px;}</style></head><body><div id="wrapper"><div id="form_container" style="width:300px; border:2px solid #D3E2FE; margin: 20px auto; text-align:center;"><h4>Club Selection:</h4><form action="" method="post" name="tablecontroller" target="_self"><select name="clubselect"><?php$current_table_count=-1;while ($row = mysql_fetch_assoc($result)) 	{ if($currentclub!=$row['i_wish_to_play']){	if($clubselected == $row['i_wish_to_play']){echo '<option value="'.$row['i_wish_to_play'].'" selected="selected">'.$row['i_wish_to_play'].' </option>';}else{echo '<option value="'.$row['i_wish_to_play'].'">'.$row['i_wish_to_play'].'</option>';}}$currentclub=$row['i_wish_to_play'];}?></select><div class="teeinput_outer"><div><span>1st group row Tee Hole:</span><input type="text" name="1rowtee" size="10" value="<?php echo $_POST['1rowtee']; ?>"  /></div><div><span>2nd group row Tee Hole:</span><input type="text" name="2rowtee" size="10" value="<?php echo $_POST['2rowtee']; ?>"  /></div><div><span>3rd group row Tee Hole:</span><input  type="text" name="3rowtee" size="10" value="<?php echo $_POST['3rowtee']; ?>"  /></div><div><span>4th group row Tee Hole:</span><input  type="text" name="4rowtee" size="10" value="<?php echo $_POST['4rowtee']; ?>"  /></div></div><!--<div class="teeinput_outer"><div><span>1st group row Tee Time:</span><input type="text" name="1rowtime" size="10" /></div><div><span>2nd group row Tee Time:</span><input type="text" name="2rowtime" size="10"  /></div><div><span>3rd group row Tee Time:</span><input  type="text" name="3rowtime" size="10"  /></div><div><span>4th group row Tee Time:</span><input  type="text" name="4rowtime" size="10"  /></div></div>--><div style="margin:20px; text-align:center; "><input name="clubsubmit" type="submit" value="Submit" /></div></form></div><?php $currentclub="";$quey1 = "SELECT * FROM _Form_Nr_3 WHERE i_wish_to_play='$clubselected' ORDER BY i_wish_to_play, my_handicap_is DESC ";$result = mysql_query($quey1) or die(mysql_error());	$current_table_count=-1;$teecount=0;while ($row = mysql_fetch_assoc($result)) 	{ 	  if($currentclub != $row['i_wish_to_play'])		  {		$current_table_count++;						   if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells			   {			   for($i=$col_count;$i<$total_col;$i++)				   {				   echo "<td> </td><td> </td>";				   }			  echo "</tr>";			fillemptygrouprows($trgroup,$total_col);				echo "</table>";				  $trcount=0;						  }		 else if ($currentclub !="")			 {			fillemptygrouprows($trgroup,$total_col);						   echo "</table> ";			$trcount=0;			}  ?><table border="0" cellpadding="0" cellspacing="0">  <tr>  <th colspan="<?php echo ($total_col*2)+1; ?>"><?php echo $row['i_wish_to_play']; ?></th>  </tr>  <?php			  echo '<tr class="blank'.$bordtop.'"><td> </td>';				for ($i=0;$i<$total_col;$i++)					{					if($i == 0)						{						$teecount++;						$teeref=$teecount.'rowtee';						echo '<td style="font-weight:bold; text-align:center;">'.strtoupper($_POST[$teeref]).' TEE</td><td> </td>';						}					else						{						echo '<td> </td><td> </td>';						}								}			echo '</tr>';	?>  <tr class="header"><td style="width:40px; text-align: center;">TIME</td><?php		for ($i=0;$i<$total_col;$i++)			{			echo '<td class="fullname">FULL NAME</td><td class="hcap">H/CAP</td>';			}			?>	</tr><?php		$col_count=0;			}		if($col_count==0)			  {						if($trcount %$starterrow == 2 && $trcount !=0)				{				echo '<tr class="starter"><td>  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td class="fullname">STARTER</td><td class="hcap"> </td>';					}			echo '</tr>';				}				else				{				$starterrow=4;				if($trcount %2 == 0 && $trcount !=0)				{				$trgroup=0;				for($j=0;$j<2;$j++)				{				if($j==0)				{				$bordtop=" bordertop";				}				else				{				$bordtop="";				}								 echo '<tr class="blank'.$bordtop.'"><td> </td>';				for ($i=0;$i<$total_col;$i++)					{					if($i == 0 && $j !=0)						{						$teecount++;						$teeref=$teecount.'rowtee';						echo '<td style="font-weight:bold; text-align:center;">'.strtoupper($_POST[$teeref]).' TEE</td><td> </td>';						}					else						{						echo '<td> </td><td> </td>';						}								}			echo '</tr>';			}			}				}		echo '<tr><td class="time">'.$_POST['1rowtime'].'  :  </td>';		$trcount++;		$trgroup++;			  }  	  if($col_count % 2 == 0)		   {		$trclass="rowcol1";		}	else		{		$trclass="rowcol2";		}  ?>		  <td class="fullname <?php echo $trclass; ?>"><?php echo strtoupper($row['name']); ?>, <?php echo strtoupper($row['surname']); ?></td>		<td class="hcap <?php echo $trclass; ?>"><?php echo $row['my_handicap_is']; ?></td><?php  		  $col_count++;		   if($col_count==$total_col)			  {			  echo "</tr>";			  $col_count=0;			  } 			$currentclub = $row['i_wish_to_play'];	   }//end while loop          if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells		   {		   for($i=$col_count;$i<$total_col;$i++)			   {			   echo "<td> </td><td> </td>";			   }		   echo "</tr>";		}		fillemptygrouprows($trgroup,$total_col);		?></table></div></body></html>

Link to comment
Share on other sites

Hi,Please find attached dtest.gifThe center STARTER row is removed and should not appear where it is - only two starter spaces - per tournament.The orange block with 10th TEE moves up into that place and will always be in the middle position of a draw for a tournament -so if the field has 120 players (in 4 columns) then the 10th TEE break will appear at row 17 and the starter breaks at row 9 (1st TEE) and 26 (10th TEE)If we have 3 columns with a field of 120 players then the split would be 10th TEE at row 24, STARTER at row 12 (1st TEE) and row 18 (10th TEE)

OK!.... no actually, im totally confused now! try below code. please do a printscreen (prt sc button), paste image into a image editor, and adjust it to the layout you expect.
<?php$quey1 = "SELECT * FROM _Form_Nr_3 ORDER BY i_wish_to_play, my_handicap_is DESC";$result = mysql_query($quey1) or die(mysql_error());$total_col=4;$starterrow = 2;if(isset($_POST['clubselect'])){$clubselected=$_POST['clubselect'];}else{while ($row = mysql_fetch_assoc($result)) 	{ 	$clubselected=$row['i_wish_to_play'];	break;	}}	  $col_colunt=0;	  $currentclub="";	  $trcount=0;	$trgroup=0;	  $trclass="";	function fillemptygrouprows($trgroup,$total_col){if($trgroup<4 && $trgroup>0)		{		for($r=$trgroup;$r<4;$r++)		{			if($r %2 == 0)				{				echo '<tr class="starter"><td>  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td class="fullname">STARTER</td><td class="hcap"> </td>';					}			echo '</tr>';				}				echo '<tr><td class="time">  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td> </td><td> </td>';					}			echo '</tr>';			}		}}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script type="text/javascript">/*<![CDATA[*//*---->*//*--*//*]]>*/</script> <style type="text/css">table {border:2px solid #D3E2FE;  width:100%;  font-size:12px;  font-family:Arial; color:#00008B;margin-bottom:20px;}table tr td {border-right:1px solid #D3E2FE;border-top:1px solid #D3E2FE;}tr.header{background-color:#D6D6D8; font-weight:bold;}.rowcol1 {background-color:#F0FFFF;}.rowcol2 {background-color:#FFFFF0;}td.fullname { padding-left:2px; font-size: 11px;}tr.header td.fullname{width:<?php echo 78/$total_col; ?>%; }tr.header td.hcap{width:<?php echo 16/$total_col; ?>%;}td.hcap {text-align:center;}#wrapper {width:95%; margin:0 auto;}.starter {background-color:#D3E2FE;text-align:center}.time {text-align:center}.blank {background-color:#FFF; }.blank td { border-width:0;}.bordertop td {border-top:1px solid #D3E2FE;}.teeinput_outer {margin-top:10px;}.teeinput_outer div span { display:block;float:left;width:160px;margin-left:10px;}</style></head><body><div id="wrapper"><div id="form_container" style="width:300px; border:2px solid #D3E2FE; margin: 20px auto; text-align:center;"><h4>Club Selection:</h4><form action="" method="post" name="tablecontroller" target="_self"><select name="clubselect"><?php$current_table_count=-1;while ($row = mysql_fetch_assoc($result)) 	{ if($currentclub!=$row['i_wish_to_play']){	if($clubselected == $row['i_wish_to_play']){echo '<option value="'.$row['i_wish_to_play'].'" selected="selected">'.$row['i_wish_to_play'].' </option>';}else{echo '<option value="'.$row['i_wish_to_play'].'">'.$row['i_wish_to_play'].'</option>';}}$currentclub=$row['i_wish_to_play'];}?></select><div class="teeinput_outer"><div><span>1st group row Tee Hole:</span><input type="text" name="1rowtee" size="10" value="<?php echo $_POST['1rowtee']; ?>"  /></div><div><span>2nd group row Tee Hole:</span><input type="text" name="2rowtee" size="10" value="<?php echo $_POST['2rowtee']; ?>"  /></div><div><span>3rd group row Tee Hole:</span><input  type="text" name="3rowtee" size="10" value="<?php echo $_POST['3rowtee']; ?>"  /></div><div><span>4th group row Tee Hole:</span><input  type="text" name="4rowtee" size="10" value="<?php echo $_POST['4rowtee']; ?>"  /></div></div><!--<div class="teeinput_outer"><div><span>1st group row Tee Time:</span><input type="text" name="1rowtime" size="10" /></div><div><span>2nd group row Tee Time:</span><input type="text" name="2rowtime" size="10"  /></div><div><span>3rd group row Tee Time:</span><input  type="text" name="3rowtime" size="10"  /></div><div><span>4th group row Tee Time:</span><input  type="text" name="4rowtime" size="10"  /></div></div>--><div style="margin:20px; text-align:center; "><input name="clubsubmit" type="submit" value="Submit" /></div></form></div><?php $currentclub="";$quey1 = "SELECT * FROM _Form_Nr_3 WHERE i_wish_to_play='$clubselected' ORDER BY i_wish_to_play, my_handicap_is DESC ";$result = mysql_query($quey1) or die(mysql_error());	$current_table_count=-1;$teecount=0;while ($row = mysql_fetch_assoc($result)) 	{ 	  if($currentclub != $row['i_wish_to_play'])		  {		$current_table_count++;						   if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells			   {			   for($i=$col_count;$i<$total_col;$i++)				   {				   echo "<td> </td><td> </td>";				   }			  echo "</tr>";			fillemptygrouprows($trgroup,$total_col);				echo "</table>";				  $trcount=0;						  }		 else if ($currentclub !="")			 {			fillemptygrouprows($trgroup,$total_col);						   echo "</table> ";			$trcount=0;			}  ?><table border="0" cellpadding="0" cellspacing="0">  <tr>  <th colspan="<?php echo ($total_col*2)+1; ?>"><?php echo $row['i_wish_to_play']; ?></th>  </tr>  <?php			  echo '<tr class="blank'.$bordtop.'"><td> </td>';				for ($i=0;$i<$total_col;$i++)					{					if($i == 0)						{						$teecount++;						$teeref=$teecount.'rowtee';						echo '<td style="font-weight:bold; text-align:center;">'.strtoupper($_POST[$teeref]).' TEE</td><td> </td>';						}					else						{						echo '<td> </td><td> </td>';						}								}			echo '</tr>';	?>  <tr class="header"><td style="width:40px; text-align: center;">TIME</td><?php		for ($i=0;$i<$total_col;$i++)			{			echo '<td class="fullname">FULL NAME</td><td class="hcap">H/CAP</td>';			}			?>	</tr><?php		$col_count=0;			}		if($col_count==0)			  {						if($trcount %$starterrow == 2 && $trcount !=0)				{				echo '<tr class="starter"><td>  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td class="fullname">STARTER</td><td class="hcap"> </td>';					}			echo '</tr>';				}				else				{				$starterrow=4;				if($trcount %2 == 0 && $trcount !=0)				{				$trgroup=0;				for($j=0;$j<2;$j++)				{				if($j==0)				{				$bordtop=" bordertop";				}				else				{				$bordtop="";				}								 echo '<tr class="blank'.$bordtop.'"><td> </td>';				for ($i=0;$i<$total_col;$i++)					{					if($i == 0 && $j !=0)						{						$teecount++;						$teeref=$teecount.'rowtee';						echo '<td style="font-weight:bold; text-align:center;">'.strtoupper($_POST[$teeref]).' TEE</td><td> </td>';						}					else						{						echo '<td> </td><td> </td>';						}								}			echo '</tr>';			}			}				}		echo '<tr><td class="time">'.$_POST['1rowtime'].'  :  </td>';		$trcount++;		$trgroup++;			  }  	  if($col_count % 2 == 0)		   {		$trclass="rowcol1";		}	else		{		$trclass="rowcol2";		}  ?>		  <td class="fullname <?php echo $trclass; ?>"><?php echo strtoupper($row['name']); ?>, <?php echo strtoupper($row['surname']); ?></td>		<td class="hcap <?php echo $trclass; ?>"><?php echo $row['my_handicap_is']; ?></td><?php  		  $col_count++;		   if($col_count==$total_col)			  {			  echo "</tr>";			  $col_count=0;			  } 			$currentclub = $row['i_wish_to_play'];	   }//end while loop          if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells		   {		   for($i=$col_count;$i<$total_col;$i++)			   {			   echo "<td> </td><td> </td>";			   }		   echo "</tr>";		}		fillemptygrouprows($trgroup,$total_col);		?></table></div></body></html>

Link to comment
Share on other sites

Hi, In terms of a draw for 3 players per group (i.e 3 BALL) the pic would look as followsdtest2.gifI hope this helps

Hi,Please find attached dtest.gifThe center STARTER row is removed and should not appear where it is - only two starter spaces - per tournament.The orange block with 10th TEE moves up into that place and will always be in the middle position of a draw for a tournament -so if the field has 120 players (in 4 columns) then the 10th TEE break will appear at row 17 and the starter breaks at row 9 (1st TEE) and 26 (10th TEE)If we have 3 columns with a field of 120 players then the split would be 10th TEE at row 24, STARTER at row 12 (1st TEE) and row 18 (10th TEE)
Link to comment
Share on other sites

try this, it returns the results as in clean gif image.

<?php    $quey1 = "SELECT * FROM _Form_Nr_3 ORDER BY i_wish_to_play, my_handicap_is DESC";$result = mysql_query($quey1) or die(mysql_error());$total_col=4;$teereftwo="First";$teerefone="Tenth";if(isset($_POST['columnselect'])){$total_col=$_POST['columnselect'];}if(isset($_POST['1rowtee'])){$teerefone=$_POST['1rowtee'];}if(isset($_POST['2rowtee'])){$teereftwo=$_POST['2rowtee'];}if(isset($_POST['clubselect'])){$clubselected=$_POST['clubselect'];}else{while ($row = mysql_fetch_assoc($result)) 	{ 	$clubselected=$row['i_wish_to_play'];	break;	}}	  $col_colunt=0;	  $currentclub="";	  $trcount=0;	$trclass="";		/////////////////////////  determine total row value and store in array ////////////////////////////////$rowsarray = array();$current_row_count=0;$quey1 = "SELECT * FROM _Form_Nr_3 WHERE i_wish_to_play='$clubselected' ORDER BY i_wish_to_play, my_handicap_is DESC ";$result = mysql_query($quey1) or die(mysql_error());				while ($row = mysql_fetch_assoc($result)) 	{ 	  if($currentclub != $row['i_wish_to_play'] && $currentclub!="")		  {			$rowsarray[$current_row_count]=$trcount;		$trcount=0;		 $col_count=0;		$current_row_count++;		}	if($col_count==0)		  {		$trcount++;		  }		$col_count++;			   if($col_count==$total_col)		  {		  $col_count=0;		  } 	$currentclub = $row['i_wish_to_play'];   }//end while loop    $rowsarray[$current_row_count]=$trcount;	   	   /////////////////////////////////////////// Show tables ////////////////////////////////////////////////////////////			  $col_colunt=0;	  $currentclub="";	  $trcount=0;	  $trclass="";	function fillemptygrouprows($trcount,$total_col, $thisrowvalue){if($trcount<(ceil($thisrowvalue/4)*4) && $trcount>0)		{				for($r=$trcount;$r<(ceil($thisrowvalue/4)*4);$r++)		{		echo '<tr><td class="time">  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td> </td><td> </td>';					}			echo '</tr>';			}		}}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script type="text/javascript">/*<![CDATA[*//*---->*//*--*//*]]>*/</script> <style type="text/css">table {border:2px solid #D3E2FE;  width:100%;  font-size:12px;  font-family:Arial; color:#00008B;margin-bottom:20px;}table tr td {border-right:1px solid #D3E2FE;border-top:1px solid #D3E2FE;}tr.header{background-color:#D6D6D8; font-weight:bold;}.rowcol1 {background-color:#F0FFFF;}.rowcol2 {background-color:#FFFFF0;}td.fullname { padding-left:2px; font-size: 11px;}tr.header td.fullname{width:<?php echo 78/$total_col; ?>%; }tr.header td.hcap{width:<?php echo 16/$total_col; ?>%;}td.hcap {text-align:center;}#wrapper {width:95%; margin:0 auto;}.starter {background-color:#D3E2FE;text-align:center}.time {text-align:center}.blank {background-color:#FFF; }.blank td { border-width:0;}.bordertop td {border-top:1px solid #D3E2FE;}.teeinput_outer {margin-top:10px;}.teeinput_outer div span { display:block;float:left;width:160px;margin-left:10px;}.highlight_tee_error{color:#FF0000; font-weight:bold;}</style></head><body><div id="wrapper"><div id="form_container" style="width:300px; border:2px solid #D3E2FE; margin: 20px auto; text-align:center;"><h4>Club Selection:</h4><form action="" method="post" name="tablecontroller" target="_self" id="tablecontroller"><select name="clubselect"><?php$quey1 = "SELECT * FROM _Form_Nr_3 ORDER BY i_wish_to_play, my_handicap_is DESC";$result = mysql_query($quey1) or die(mysql_error());$current_table_count=-1;while ($row = mysql_fetch_assoc($result)) 	{ 	if($currentclub!=$row['i_wish_to_play'])		{					if($clubselected == $row['i_wish_to_play'])			{			echo '<option value="'.$row['i_wish_to_play'].'" selected="selected">'.$row['i_wish_to_play'].' </option>\n';			}		else			{			echo '<option value="'.$row['i_wish_to_play'].'">'.$row['i_wish_to_play'].'</option>\n';			}		}	$currentclub=$row['i_wish_to_play'];	}?></select><select name="columnselect"><?phpfor($j=2;$j<5;$j++){if($total_col == $j){echo '<option value="'.$j.'" selected="selected">'.($j).' Ball</option>\n';}else{echo '<option value="'.$j.'">'.($j).' Ball</option>\n';}}$teeholetext= array('First', 'Second', 'Third', 'Fourth', 'Fifth',  'Sixth', 'Seventh', 'Eighth', 'Ninth', 'Tenth', 'Eleventh', 'Twelve', 'Thirteenth', 'Fourteenth', 'Fifteenth', 'Sixteenth', 'Seventeenth', 'Eighteenth');?></select><div class="teeinput_outer"><div><span>1st group row Tee Hole:</span><select name="1rowtee"><?phpfor($t=0;$t<18;$t++){if($teerefone == $teeholetext[$t]){echo '<option selected="selected" value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}else{echo '<option value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}}?></select></div><div><span>2nd group row Tee Hole:</span><select name="2rowtee"><?phpfor($t=0;$t<18;$t++){if($teereftwo == $teeholetext[$t]){echo '<option selected="selected" value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}else{echo '<option value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}}?></select></div></div><div class="teeinput_outer"><div><span>Tee off Time:</span><select name="1rowtime"><?php for($t=8;$t<21;$t++){if($_POST['1rowtime'] == $t.':00'){echo '<option selected="selected" value="'.$t.':00">'.$t.':00</option>\n';}else{echo '<option value="'.$t.':00">'.$t.':00</option>\n';}}?></select></div></div><div style="margin:20px; text-align:center; "><input name="clubsubmit" type="submit" value="Submit" /></div></form></div><?php $currentclub="";$quey1 = "SELECT * FROM _Form_Nr_3 WHERE i_wish_to_play='$clubselected' ORDER BY i_wish_to_play, my_handicap_is DESC ";$result = mysql_query($quey1) or die(mysql_error());	//echo mysql_num_rows($result);$current_table_count=-1;$teecount=0;while ($row = mysql_fetch_assoc($result)) 	{ 		//echo $rowsarray[$current_table_count].'xxxxxxx<br />';	  if($currentclub != $row['i_wish_to_play']) // if(1)		  {		$current_table_count++;		$teecount=0;					   if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells			   {			   for($i=$col_count;$i<$total_col;$i++)				   {				   echo "<td> </td><td> </td>";				   }			  echo "</tr>";			fillemptygrouprows($trcount,$total_col, ceil($rowsarray[$current_table_count]));				echo "</table>";				  $trcount=0;						  }		 else if ($currentclub !="")			 {			fillemptygrouprows($trcount,$total_col, ceil($rowsarray[$current_table_count]));						   echo "</table> ";			$trcount=0;			}  ?><table border="0" cellpadding="0" cellspacing="0">  <tr>  <th colspan="<?php echo ($total_col*2)+1; ?>"><?php echo $row['i_wish_to_play']; ?></th>  </tr>  <?php	echo '<tr class="blank'.$bordtop.'"><td> </td>';		for ($i=0;$i<$total_col;$i++) //for (1) adds top tee number header		{		if($i == 0)			{			echo '<td style="font-weight:bold; text-align:center;">'.strtoupper($teerefone).' TEE</td><td> </td>';			}		else			{			echo '<td> </td><td> </td>';			}					}//end for 1					echo '</tr>';	?>  <tr class="header"><td style="width:40px; text-align: center;">TIME</td><?php		for ($i=0;$i<$total_col;$i++)//add fullname and h/cap header			{			echo '<td class="fullname">FULL NAME</td><td class="hcap">H/CAP</td>';			}			?>	</tr><?php		$col_count=0;		} //end if (1)				if($col_count==0)	  {		if($trcount == ceil($rowsarray[$current_table_count]/4) || $trcount == (ceil($rowsarray[$current_table_count]/4)+ceil($rowsarray[$current_table_count]/4)*2))			{			$timestamp=strtotime($_POST['1rowtime']);			$timeinterval=$trgroupcount*10;			$teetime=date('H:i', strtotime("+$timeinterval minutes", $timestamp));			$trgroupcount++;			echo '<tr class="starter"><td>'.$teetime.'</td>';			for ($i=0;$i<$total_col;$i++)				{				echo '<td class="fullname">STARTER</td><td class="hcap"> </td>';				}			echo '</tr>';			}		else			{			if($trcount  % ((ceil($rowsarray[$current_table_count]/4)*2)) ==0 && $trcount!=0)				{								for($j=0;$j<2;$j++)					{					if($j==0)						{						$bordtop=" bordertop";						}					else						{						$bordtop="";						}					 echo '<tr class="blank'.$bordtop.'"><td> </td>';					for ($i=0;$i<$total_col;$i++)						{						if($i == 0 && $j !=0)							{							$trgroupcount=0;							$teetexterror="";							if($teereftwo==$teerefone)							{							$teetexterror="highlight_tee_error";							$teereftwo="Matching Tee holes";							}														echo '<td style="font-weight:bold; text-align:center;"><span class="'.$teetexterror.'">'.strtoupper("$teereftwo").'</span> TEE</td><td> </td>';							}						else							{							echo '<td> </td><td> </td>';							}						}			echo '</tr>';					}				}			}			$timestamp=strtotime($_POST['1rowtime']);			$timeinterval=$trgroupcount*10;			$teetime=date('H:i', strtotime("+$timeinterval minutes", $timestamp));		echo '<tr><td class="time">'.$teetime.'</td>';		$trcount++;		$trgroupcount++;	  }  	  if($col_count % 2 == 0)		   {		$trclass="rowcol1";		}	else		{		$trclass="rowcol2";		}				if($col_count < (ceil($rowsarray[$current_table_count]*$total_col)/$total_col)+1)		{  ?>  <td class="fullname <?php echo $trclass; ?>"><?php echo strtoupper($row['name']); ?>, <?php echo strtoupper($row['surname']); ?></td>		<td class="hcap <?php echo $trclass; ?>"><?php echo $row['my_handicap_is']; ?></td><?php  }		  $col_count++;		   if($col_count==$total_col)			  {			  echo "</tr>";			  $col_count=0;			  } 			$currentclub = $row['i_wish_to_play'];	   }//end while loop          if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells		   {		   for($i=$col_count;$i<$total_col;$i++)			   {			   echo "<td> </td><td> </td>";			   }		   echo "</tr>";		}		fillemptygrouprows($trcount,$total_col, ceil($rowsarray[$current_table_count]));	?></table></div></body></html>

Link to comment
Share on other sites

Hi,It works very well -THANKS SO MUCHThe part that selects the TEE - the time of start and the choice of tournament and 2 BALL/ 3 Ball / 4Ball should ideally be on a seperate page - that only an adminitrator may adjust.I have started with that at this linkThe admin. persdon would selcct the button at the bottom of the page T TIMES following selection (which I still need to do) the admin person selects "next" this takes him/her to the page where these said items should be.Once they ar eselected the draws can be veiwed by selecting the DRAW button belowI really appreciate what you have done below and the amount of time you have rendered.

try this, it returns the results as in clean gif image.
<?php    $quey1 = "SELECT * FROM _Form_Nr_3 ORDER BY i_wish_to_play, my_handicap_is DESC";$result = mysql_query($quey1) or die(mysql_error());$total_col=4;$teereftwo="First";$teerefone="Tenth";if(isset($_POST['columnselect'])){$total_col=$_POST['columnselect'];}if(isset($_POST['1rowtee'])){$teerefone=$_POST['1rowtee'];}if(isset($_POST['2rowtee'])){$teereftwo=$_POST['2rowtee'];}if(isset($_POST['clubselect'])){$clubselected=$_POST['clubselect'];}else{while ($row = mysql_fetch_assoc($result)) 	{ 	$clubselected=$row['i_wish_to_play'];	break;	}}	  $col_colunt=0;	  $currentclub="";	  $trcount=0;	$trclass="";		/////////////////////////  determine total row value and store in array ////////////////////////////////$rowsarray = array();$current_row_count=0;$quey1 = "SELECT * FROM _Form_Nr_3 WHERE i_wish_to_play='$clubselected' ORDER BY i_wish_to_play, my_handicap_is DESC ";$result = mysql_query($quey1) or die(mysql_error());				while ($row = mysql_fetch_assoc($result)) 	{ 	  if($currentclub != $row['i_wish_to_play'] && $currentclub!="")		  {			$rowsarray[$current_row_count]=$trcount;		$trcount=0;		 $col_count=0;		$current_row_count++;		}	if($col_count==0)		  {		$trcount++;		  }		$col_count++;			   if($col_count==$total_col)		  {		  $col_count=0;		  } 	$currentclub = $row['i_wish_to_play'];   }//end while loop    $rowsarray[$current_row_count]=$trcount;	   	   /////////////////////////////////////////// Show tables ////////////////////////////////////////////////////////////			  $col_colunt=0;	  $currentclub="";	  $trcount=0;	  $trclass="";	function fillemptygrouprows($trcount,$total_col, $thisrowvalue){if($trcount<(ceil($thisrowvalue/4)*4) && $trcount>0)		{				for($r=$trcount;$r<(ceil($thisrowvalue/4)*4);$r++)		{		echo '<tr><td class="time">  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td> </td><td> </td>';					}			echo '</tr>';			}		}}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script type="text/javascript">/*<![CDATA[*//*---->*//*--*//*]]>*/</script> <style type="text/css">table {border:2px solid #D3E2FE;  width:100%;  font-size:12px;  font-family:Arial; color:#00008B;margin-bottom:20px;}table tr td {border-right:1px solid #D3E2FE;border-top:1px solid #D3E2FE;}tr.header{background-color:#D6D6D8; font-weight:bold;}.rowcol1 {background-color:#F0FFFF;}.rowcol2 {background-color:#FFFFF0;}td.fullname { padding-left:2px; font-size: 11px;}tr.header td.fullname{width:<?php echo 78/$total_col; ?>%; }tr.header td.hcap{width:<?php echo 16/$total_col; ?>%;}td.hcap {text-align:center;}#wrapper {width:95%; margin:0 auto;}.starter {background-color:#D3E2FE;text-align:center}.time {text-align:center}.blank {background-color:#FFF; }.blank td { border-width:0;}.bordertop td {border-top:1px solid #D3E2FE;}.teeinput_outer {margin-top:10px;}.teeinput_outer div span { display:block;float:left;width:160px;margin-left:10px;}.highlight_tee_error{color:#FF0000; font-weight:bold;}</style></head><body><div id="wrapper"><div id="form_container" style="width:300px; border:2px solid #D3E2FE; margin: 20px auto; text-align:center;"><h4>Club Selection:</h4><form action="" method="post" name="tablecontroller" target="_self" id="tablecontroller"><select name="clubselect"><?php$quey1 = "SELECT * FROM _Form_Nr_3 ORDER BY i_wish_to_play, my_handicap_is DESC";$result = mysql_query($quey1) or die(mysql_error());$current_table_count=-1;while ($row = mysql_fetch_assoc($result)) 	{ 	if($currentclub!=$row['i_wish_to_play'])		{					if($clubselected == $row['i_wish_to_play'])			{			echo '<option value="'.$row['i_wish_to_play'].'" selected="selected">'.$row['i_wish_to_play'].' </option>\n';			}		else			{			echo '<option value="'.$row['i_wish_to_play'].'">'.$row['i_wish_to_play'].'</option>\n';			}		}	$currentclub=$row['i_wish_to_play'];	}?></select><select name="columnselect"><?phpfor($j=2;$j<5;$j++){if($total_col == $j){echo '<option value="'.$j.'" selected="selected">'.($j).' Ball</option>\n';}else{echo '<option value="'.$j.'">'.($j).' Ball</option>\n';}}$teeholetext= array('First', 'Second', 'Third', 'Fourth', 'Fifth',  'Sixth', 'Seventh', 'Eighth', 'Ninth', 'Tenth', 'Eleventh', 'Twelve', 'Thirteenth', 'Fourteenth', 'Fifteenth', 'Sixteenth', 'Seventeenth', 'Eighteenth');?></select><div class="teeinput_outer"><div><span>1st group row Tee Hole:</span><select name="1rowtee"><?phpfor($t=0;$t<18;$t++){if($teerefone == $teeholetext[$t]){echo '<option selected="selected" value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}else{echo '<option value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}}?></select></div><div><span>2nd group row Tee Hole:</span><select name="2rowtee"><?phpfor($t=0;$t<18;$t++){if($teereftwo == $teeholetext[$t]){echo '<option selected="selected" value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}else{echo '<option value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}}?></select></div></div><div class="teeinput_outer"><div><span>Tee off Time:</span><select name="1rowtime"><?php for($t=8;$t<21;$t++){if($_POST['1rowtime'] == $t.':00'){echo '<option selected="selected" value="'.$t.':00">'.$t.':00</option>\n';}else{echo '<option value="'.$t.':00">'.$t.':00</option>\n';}}?></select></div></div><div style="margin:20px; text-align:center; "><input name="clubsubmit" type="submit" value="Submit" /></div></form></div><?php $currentclub="";$quey1 = "SELECT * FROM _Form_Nr_3 WHERE i_wish_to_play='$clubselected' ORDER BY i_wish_to_play, my_handicap_is DESC ";$result = mysql_query($quey1) or die(mysql_error());	//echo mysql_num_rows($result);$current_table_count=-1;$teecount=0;while ($row = mysql_fetch_assoc($result)) 	{ 		//echo $rowsarray[$current_table_count].'xxxxxxx<br />';	  if($currentclub != $row['i_wish_to_play']) // if(1)		  {		$current_table_count++;		$teecount=0;					   if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells			   {			   for($i=$col_count;$i<$total_col;$i++)				   {				   echo "<td> </td><td> </td>";				   }			  echo "</tr>";			fillemptygrouprows($trcount,$total_col, ceil($rowsarray[$current_table_count]));				echo "</table>";				  $trcount=0;						  }		 else if ($currentclub !="")			 {			fillemptygrouprows($trcount,$total_col, ceil($rowsarray[$current_table_count]));						   echo "</table> ";			$trcount=0;			}  ?><table border="0" cellpadding="0" cellspacing="0">  <tr>  <th colspan="<?php echo ($total_col*2)+1; ?>"><?php echo $row['i_wish_to_play']; ?></th>  </tr>  <?php	echo '<tr class="blank'.$bordtop.'"><td> </td>';		for ($i=0;$i<$total_col;$i++) //for (1) adds top tee number header		{		if($i == 0)			{			echo '<td style="font-weight:bold; text-align:center;">'.strtoupper($teerefone).' TEE</td><td> </td>';			}		else			{			echo '<td> </td><td> </td>';			}					}//end for 1					echo '</tr>';	?>  <tr class="header"><td style="width:40px; text-align: center;">TIME</td><?php		for ($i=0;$i<$total_col;$i++)//add fullname and h/cap header			{			echo '<td class="fullname">FULL NAME</td><td class="hcap">H/CAP</td>';			}			?>	</tr><?php		$col_count=0;		} //end if (1)				if($col_count==0)	  {		if($trcount == ceil($rowsarray[$current_table_count]/4) || $trcount == (ceil($rowsarray[$current_table_count]/4)+ceil($rowsarray[$current_table_count]/4)*2))			{			$timestamp=strtotime($_POST['1rowtime']);			$timeinterval=$trgroupcount*10;			$teetime=date('H:i', strtotime("+$timeinterval minutes", $timestamp));			$trgroupcount++;			echo '<tr class="starter"><td>'.$teetime.'</td>';			for ($i=0;$i<$total_col;$i++)				{				echo '<td class="fullname">STARTER</td><td class="hcap"> </td>';				}			echo '</tr>';			}		else			{			if($trcount  % ((ceil($rowsarray[$current_table_count]/4)*2)) ==0 && $trcount!=0)				{								for($j=0;$j<2;$j++)					{					if($j==0)						{						$bordtop=" bordertop";						}					else						{						$bordtop="";						}					 echo '<tr class="blank'.$bordtop.'"><td> </td>';					for ($i=0;$i<$total_col;$i++)						{						if($i == 0 && $j !=0)							{							$trgroupcount=0;							$teetexterror="";							if($teereftwo==$teerefone)							{							$teetexterror="highlight_tee_error";							$teereftwo="Matching Tee holes";							}														echo '<td style="font-weight:bold; text-align:center;"><span class="'.$teetexterror.'">'.strtoupper("$teereftwo").'</span> TEE</td><td> </td>';							}						else							{							echo '<td> </td><td> </td>';							}						}			echo '</tr>';					}				}			}			$timestamp=strtotime($_POST['1rowtime']);			$timeinterval=$trgroupcount*10;			$teetime=date('H:i', strtotime("+$timeinterval minutes", $timestamp));		echo '<tr><td class="time">'.$teetime.'</td>';		$trcount++;		$trgroupcount++;	  }  	  if($col_count % 2 == 0)		   {		$trclass="rowcol1";		}	else		{		$trclass="rowcol2";		}				if($col_count < (ceil($rowsarray[$current_table_count]*$total_col)/$total_col)+1)		{  ?>  <td class="fullname <?php echo $trclass; ?>"><?php echo strtoupper($row['name']); ?>, <?php echo strtoupper($row['surname']); ?></td>		<td class="hcap <?php echo $trclass; ?>"><?php echo $row['my_handicap_is']; ?></td><?php  }		  $col_count++;		   if($col_count==$total_col)			  {			  echo "</tr>";			  $col_count=0;			  } 			$currentclub = $row['i_wish_to_play'];	   }//end while loop          if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells		   {		   for($i=$col_count;$i<$total_col;$i++)			   {			   echo "<td> </td><td> </td>";			   }		   echo "</tr>";		}		fillemptygrouprows($trcount,$total_col, ceil($rowsarray[$current_table_count]));	?></table></div></body></html>

Link to comment
Share on other sites

try this, it returns the results as in clean gif image.
<?php    $quey1 = "SELECT * FROM _Form_Nr_3 ORDER BY i_wish_to_play, my_handicap_is DESC";$result = mysql_query($quey1) or die(mysql_error());$total_col=4;$teereftwo="First";$teerefone="Tenth";if(isset($_POST['columnselect'])){$total_col=$_POST['columnselect'];}if(isset($_POST['1rowtee'])){$teerefone=$_POST['1rowtee'];}if(isset($_POST['2rowtee'])){$teereftwo=$_POST['2rowtee'];}if(isset($_POST['clubselect'])){$clubselected=$_POST['clubselect'];}else{while ($row = mysql_fetch_assoc($result)) 	{ 	$clubselected=$row['i_wish_to_play'];	break;	}}	  $col_colunt=0;	  $currentclub="";	  $trcount=0;	$trclass="";		/////////////////////////  determine total row value and store in array ////////////////////////////////$rowsarray = array();$current_row_count=0;$quey1 = "SELECT * FROM _Form_Nr_3 WHERE i_wish_to_play='$clubselected' ORDER BY i_wish_to_play, my_handicap_is DESC ";$result = mysql_query($quey1) or die(mysql_error());				while ($row = mysql_fetch_assoc($result)) 	{ 	  if($currentclub != $row['i_wish_to_play'] && $currentclub!="")		  {			$rowsarray[$current_row_count]=$trcount;		$trcount=0;		 $col_count=0;		$current_row_count++;		}	if($col_count==0)		  {		$trcount++;		  }		$col_count++;			   if($col_count==$total_col)		  {		  $col_count=0;		  } 	$currentclub = $row['i_wish_to_play'];   }//end while loop    $rowsarray[$current_row_count]=$trcount;	   	   /////////////////////////////////////////// Show tables ////////////////////////////////////////////////////////////			  $col_colunt=0;	  $currentclub="";	  $trcount=0;	  $trclass="";	function fillemptygrouprows($trcount,$total_col, $thisrowvalue){if($trcount<(ceil($thisrowvalue/4)*4) && $trcount>0)		{				for($r=$trcount;$r<(ceil($thisrowvalue/4)*4);$r++)		{		echo '<tr><td class="time">  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td> </td><td> </td>';					}			echo '</tr>';			}		}}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script type="text/javascript">/*<![CDATA[*//*---->*//*--*//*]]>*/</script> <style type="text/css">table {border:2px solid #D3E2FE;  width:100%;  font-size:12px;  font-family:Arial; color:#00008B;margin-bottom:20px;}table tr td {border-right:1px solid #D3E2FE;border-top:1px solid #D3E2FE;}tr.header{background-color:#D6D6D8; font-weight:bold;}.rowcol1 {background-color:#F0FFFF;}.rowcol2 {background-color:#FFFFF0;}td.fullname { padding-left:2px; font-size: 11px;}tr.header td.fullname{width:<?php echo 78/$total_col; ?>%; }tr.header td.hcap{width:<?php echo 16/$total_col; ?>%;}td.hcap {text-align:center;}#wrapper {width:95%; margin:0 auto;}.starter {background-color:#D3E2FE;text-align:center}.time {text-align:center}.blank {background-color:#FFF; }.blank td { border-width:0;}.bordertop td {border-top:1px solid #D3E2FE;}.teeinput_outer {margin-top:10px;}.teeinput_outer div span { display:block;float:left;width:160px;margin-left:10px;}.highlight_tee_error{color:#FF0000; font-weight:bold;}</style></head><body><div id="wrapper"><div id="form_container" style="width:300px; border:2px solid #D3E2FE; margin: 20px auto; text-align:center;"><h4>Club Selection:</h4><form action="" method="post" name="tablecontroller" target="_self" id="tablecontroller"><select name="clubselect"><?php$quey1 = "SELECT * FROM _Form_Nr_3 ORDER BY i_wish_to_play, my_handicap_is DESC";$result = mysql_query($quey1) or die(mysql_error());$current_table_count=-1;while ($row = mysql_fetch_assoc($result)) 	{ 	if($currentclub!=$row['i_wish_to_play'])		{					if($clubselected == $row['i_wish_to_play'])			{			echo '<option value="'.$row['i_wish_to_play'].'" selected="selected">'.$row['i_wish_to_play'].' </option>\n';			}		else			{			echo '<option value="'.$row['i_wish_to_play'].'">'.$row['i_wish_to_play'].'</option>\n';			}		}	$currentclub=$row['i_wish_to_play'];	}?></select><select name="columnselect"><?phpfor($j=2;$j<5;$j++){if($total_col == $j){echo '<option value="'.$j.'" selected="selected">'.($j).' Ball</option>\n';}else{echo '<option value="'.$j.'">'.($j).' Ball</option>\n';}}$teeholetext= array('First', 'Second', 'Third', 'Fourth', 'Fifth',  'Sixth', 'Seventh', 'Eighth', 'Ninth', 'Tenth', 'Eleventh', 'Twelve', 'Thirteenth', 'Fourteenth', 'Fifteenth', 'Sixteenth', 'Seventeenth', 'Eighteenth');?></select><div class="teeinput_outer"><div><span>1st group row Tee Hole:</span><select name="1rowtee"><?phpfor($t=0;$t<18;$t++){if($teerefone == $teeholetext[$t]){echo '<option selected="selected" value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}else{echo '<option value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}}?></select></div><div><span>2nd group row Tee Hole:</span><select name="2rowtee"><?phpfor($t=0;$t<18;$t++){if($teereftwo == $teeholetext[$t]){echo '<option selected="selected" value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}else{echo '<option value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}}?></select></div></div><div class="teeinput_outer"><div><span>Tee off Time:</span><select name="1rowtime"><?php for($t=8;$t<21;$t++){if($_POST['1rowtime'] == $t.':00'){echo '<option selected="selected" value="'.$t.':00">'.$t.':00</option>\n';}else{echo '<option value="'.$t.':00">'.$t.':00</option>\n';}}?></select></div></div><div style="margin:20px; text-align:center; "><input name="clubsubmit" type="submit" value="Submit" /></div></form></div><?php $currentclub="";$quey1 = "SELECT * FROM _Form_Nr_3 WHERE i_wish_to_play='$clubselected' ORDER BY i_wish_to_play, my_handicap_is DESC ";$result = mysql_query($quey1) or die(mysql_error());	//echo mysql_num_rows($result);$current_table_count=-1;$teecount=0;while ($row = mysql_fetch_assoc($result)) 	{ 		//echo $rowsarray[$current_table_count].'xxxxxxx<br />';	  if($currentclub != $row['i_wish_to_play']) // if(1)		  {		$current_table_count++;		$teecount=0;					   if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells			   {			   for($i=$col_count;$i<$total_col;$i++)				   {				   echo "<td> </td><td> </td>";				   }			  echo "</tr>";			fillemptygrouprows($trcount,$total_col, ceil($rowsarray[$current_table_count]));				echo "</table>";				  $trcount=0;						  }		 else if ($currentclub !="")			 {			fillemptygrouprows($trcount,$total_col, ceil($rowsarray[$current_table_count]));						   echo "</table> ";			$trcount=0;			}  ?><table border="0" cellpadding="0" cellspacing="0">  <tr>  <th colspan="<?php echo ($total_col*2)+1; ?>"><?php echo $row['i_wish_to_play']; ?></th>  </tr>  <?php	echo '<tr class="blank'.$bordtop.'"><td> </td>';		for ($i=0;$i<$total_col;$i++) //for (1) adds top tee number header		{		if($i == 0)			{			echo '<td style="font-weight:bold; text-align:center;">'.strtoupper($teerefone).' TEE</td><td> </td>';			}		else			{			echo '<td> </td><td> </td>';			}					}//end for 1					echo '</tr>';	?>  <tr class="header"><td style="width:40px; text-align: center;">TIME</td><?php		for ($i=0;$i<$total_col;$i++)//add fullname and h/cap header			{			echo '<td class="fullname">FULL NAME</td><td class="hcap">H/CAP</td>';			}			?>	</tr><?php		$col_count=0;		} //end if (1)				if($col_count==0)	  {		if($trcount == ceil($rowsarray[$current_table_count]/4) || $trcount == (ceil($rowsarray[$current_table_count]/4)+ceil($rowsarray[$current_table_count]/4)*2))			{			$timestamp=strtotime($_POST['1rowtime']);			$timeinterval=$trgroupcount*10;			$teetime=date('H:i', strtotime("+$timeinterval minutes", $timestamp));			$trgroupcount++;			echo '<tr class="starter"><td>'.$teetime.'</td>';			for ($i=0;$i<$total_col;$i++)				{				echo '<td class="fullname">STARTER</td><td class="hcap"> </td>';				}			echo '</tr>';			}		else			{			if($trcount  % ((ceil($rowsarray[$current_table_count]/4)*2)) ==0 && $trcount!=0)				{								for($j=0;$j<2;$j++)					{					if($j==0)						{						$bordtop=" bordertop";						}					else						{						$bordtop="";						}					 echo '<tr class="blank'.$bordtop.'"><td> </td>';					for ($i=0;$i<$total_col;$i++)						{						if($i == 0 && $j !=0)							{							$trgroupcount=0;							$teetexterror="";							if($teereftwo==$teerefone)							{							$teetexterror="highlight_tee_error";							$teereftwo="Matching Tee holes";							}														echo '<td style="font-weight:bold; text-align:center;"><span class="'.$teetexterror.'">'.strtoupper("$teereftwo").'</span> TEE</td><td> </td>';							}						else							{							echo '<td> </td><td> </td>';							}						}			echo '</tr>';					}				}			}			$timestamp=strtotime($_POST['1rowtime']);			$timeinterval=$trgroupcount*10;			$teetime=date('H:i', strtotime("+$timeinterval minutes", $timestamp));		echo '<tr><td class="time">'.$teetime.'</td>';		$trcount++;		$trgroupcount++;	  }  	  if($col_count % 2 == 0)		   {		$trclass="rowcol1";		}	else		{		$trclass="rowcol2";		}				if($col_count < (ceil($rowsarray[$current_table_count]*$total_col)/$total_col)+1)		{  ?>  <td class="fullname <?php echo $trclass; ?>"><?php echo strtoupper($row['name']); ?>, <?php echo strtoupper($row['surname']); ?></td>		<td class="hcap <?php echo $trclass; ?>"><?php echo $row['my_handicap_is']; ?></td><?php  }		  $col_count++;		   if($col_count==$total_col)			  {			  echo "</tr>";			  $col_count=0;			  } 			$currentclub = $row['i_wish_to_play'];	   }//end while loop          if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells		   {		   for($i=$col_count;$i<$total_col;$i++)			   {			   echo "<td> </td><td> </td>";			   }		   echo "</tr>";		}		fillemptygrouprows($trcount,$total_col, ceil($rowsarray[$current_table_count]));	?></table></div></body></html>

Link to comment
Share on other sites

  • 2 weeks later...

Hi,Just a thought - is it possible to create a section that makes the interval variable.That is instead of making it a fiwed ten minutes - I have the choice of selecting in a range of bewteen 6 and 10 minutes?

Link to comment
Share on other sites

No problem, p.s reason i asked about how far you lived from elspark is that i have relation living there, anyway enjoy the golf and football!

<?phpmysql_select_db($database_golfconn, $golfconn);$quey1 = "SELECT * FROM _Form_Nr_3 ORDER BY i_wish_to_play, my_handicap_is DESC";$result = mysql_query($quey1) or die(mysql_error());$total_col=4;$teereftwo="First";$teerefone="Tenth";$teeperiod=6;if(isset($_POST['columnselect'])){$total_col=$_POST['columnselect'];}if(isset($_POST['timeperiod'])){$teeperiod=$_POST['timeperiod'];}if(isset($_POST['1rowtee'])){$teerefone=$_POST['1rowtee'];}if(isset($_POST['2rowtee'])){$teereftwo=$_POST['2rowtee'];}if(isset($_POST['clubselect'])){$clubselected=$_POST['clubselect'];}else{while ($row = mysql_fetch_assoc($result)) 	{ 	$clubselected=$row['i_wish_to_play'];	break;	}}	  $col_colunt=0;	  $currentclub="";	  $trcount=0;	$trclass="";		/////////////////////////  determine total row value and store in array ////////////////////////////////$rowsarray = array();$current_row_count=0;$quey1 = "SELECT * FROM _Form_Nr_3 WHERE i_wish_to_play='$clubselected' ORDER BY i_wish_to_play, my_handicap_is DESC ";$result = mysql_query($quey1) or die(mysql_error());				while ($row = mysql_fetch_assoc($result)) 	{ 	  if($currentclub != $row['i_wish_to_play'] && $currentclub!="")		  {			$rowsarray[$current_row_count]=$trcount;		$trcount=0;		 $col_count=0;		$current_row_count++;		}	if($col_count==0)		  {		$trcount++;		  }		$col_count++;			   if($col_count==$total_col)		  {		  $col_count=0;		  } 	$currentclub = $row['i_wish_to_play'];   }//end while loop    $rowsarray[$current_row_count]=$trcount;	   	   /////////////////////////////////////////// Show tables ////////////////////////////////////////////////////////////			  $col_colunt=0;	  $currentclub="";	  $trcount=0;	  $trclass="";	function fillemptygrouprows($trcount,$total_col, $thisrowvalue){if($trcount<(ceil($thisrowvalue/4)*4) && $trcount>0)		{				for($r=$trcount;$r<(ceil($thisrowvalue/4)*4);$r++)		{		echo '<tr><td class="time">  :  </td>';				for ($i=0;$i<$total_col;$i++)					{			echo '<td> </td><td> </td>';					}			echo '</tr>';			}		}}?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script type="text/javascript">/*<![CDATA[*//*---->*//*--*//*]]>*/</script> <style type="text/css">table {border:2px solid #D3E2FE;  width:100%;  font-size:12px;  font-family:Arial; color:#00008B;margin-bottom:20px;}table tr td {border-right:1px solid #D3E2FE;border-top:1px solid #D3E2FE;}tr.header{background-color:#D6D6D8; font-weight:bold;}.rowcol1 {background-color:#F0FFFF;}.rowcol2 {background-color:#FFFFF0;}td.fullname { padding-left:2px; font-size: 11px;}tr.header td.fullname{width:<?php echo 78/$total_col; ?>%; }tr.header td.hcap{width:<?php echo 16/$total_col; ?>%;}td.hcap {text-align:center;}#wrapper {width:95%; margin:0 auto;}.starter {background-color:#D3E2FE;text-align:center}.time {text-align:center}.blank {background-color:#FFF; }.blank td { border-width:0;}.bordertop td {border-top:1px solid #D3E2FE;}.teeinput_outer {margin-top:10px;}.teeinput_outer div span { display:block;float:left;width:160px;margin-left:10px;}.highlight_tee_error{color:#FF0000; font-weight:bold;}</style></head><body><div id="wrapper"><div id="form_container" style="width:300px; border:2px solid #D3E2FE; margin: 20px auto; text-align:center;"><h4>Club Selection:</h4><form action="" method="post" name="tablecontroller" target="_self" id="tablecontroller"><select name="clubselect"><?php$quey1 = "SELECT * FROM _Form_Nr_3 ORDER BY i_wish_to_play, my_handicap_is DESC";$result = mysql_query($quey1) or die(mysql_error());$current_table_count=-1;while ($row = mysql_fetch_assoc($result)) 	{ 	if($currentclub!=$row['i_wish_to_play'])		{					if($clubselected == $row['i_wish_to_play'])			{			echo '<option value="'.$row['i_wish_to_play'].'" selected="selected">'.$row['i_wish_to_play'].' </option>\n';			}		else			{			echo '<option value="'.$row['i_wish_to_play'].'">'.$row['i_wish_to_play'].'</option>\n';			}		}	$currentclub=$row['i_wish_to_play'];	}?></select><select name="columnselect"><?phpfor($j=2;$j<5;$j++){if($total_col == $j){echo '<option value="'.$j.'" selected="selected">'.($j).' Ball</option>\n';}else{echo '<option value="'.$j.'">'.($j).' Ball</option>\n';}}$teeholetext= array('First', 'Second', 'Third', 'Fourth', 'Fifth',  'Sixth', 'Seventh', 'Eighth', 'Ninth', 'Tenth', 'Eleventh', 'Twelve', 'Thirteenth', 'Fourteenth', 'Fifteenth', 'Sixteenth', 'Seventeenth', 'Eighteenth');?></select><div class="teeinput_outer"><div><span>1st group row Tee Hole:</span><select name="1rowtee"><?phpfor($t=0;$t<18;$t++){if($teerefone == $teeholetext[$t]){echo '<option selected="selected" value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}else{echo '<option value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}}?></select></div><div><span>2nd group row Tee Hole:</span><select name="2rowtee"><?phpfor($t=0;$t<18;$t++){if($teereftwo == $teeholetext[$t]){echo '<option selected="selected" value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}else{echo '<option value="'.$teeholetext[$t].'">'.$teeholetext[$t].'</option>\n';}}?></select></div></div><div class="teeinput_outer"><div><span>Tee off Time:</span><select name="1rowtime"><?php for($t=8;$t<21;$t++){if($_POST['1rowtime'] == $t.':00'){echo '<option selected="selected" value="'.$t.':00">'.$t.':00</option>\n';}else{echo '<option value="'.$t.':00">'.$t.':00</option>\n';}}?></select></div></div><div class="teeinput_outer"><div><span>Set Period:</span><select name="timeperiod"><?php for($t=6;$t<=10;$t++){if($_POST['timeperiod'] == $t){echo '<option selected="selected" value="'.$t.'">'.$t.'</option>\n';}else{echo '<option value="'.$t.'">'.$t.'</option>\n';}}?></select></div></div><div style="margin:20px; text-align:center; "><input name="clubsubmit" type="submit" value="Submit" /></div></form></div><?php $currentclub="";$quey1 = "SELECT * FROM _Form_Nr_3 WHERE i_wish_to_play='$clubselected' ORDER BY i_wish_to_play, my_handicap_is DESC ";$result = mysql_query($quey1) or die(mysql_error());	//echo mysql_num_rows($result);$current_table_count=-1;$teecount=0;while ($row = mysql_fetch_assoc($result)) 	{ 		//echo $rowsarray[$current_table_count].'xxxxxxx<br />';	  if($currentclub != $row['i_wish_to_play']) // if(1)		  {		$current_table_count++;		$teecount=0;					   if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells			   {			   for($i=$col_count;$i<$total_col;$i++)				   {				   echo "<td> </td><td> </td>";				   }			  echo "</tr>";			fillemptygrouprows($trcount,$total_col, ceil($rowsarray[$current_table_count]));				echo "</table>";				  $trcount=0;						  }		 else if ($currentclub !="")			 {			fillemptygrouprows($trcount,$total_col, ceil($rowsarray[$current_table_count]));						   echo "</table> ";			$trcount=0;			}  ?><table border="0" cellpadding="0" cellspacing="0">  <tr>  <th colspan="<?php echo ($total_col*2)+1; ?>"><?php echo $row['i_wish_to_play']; ?></th>  </tr>  <?php	echo '<tr class="blank'.$bordtop.'"><td> </td>';		for ($i=0;$i<$total_col;$i++) //for (1) adds top tee number header		{		if($i == 0)			{			echo '<td style="font-weight:bold; text-align:center;">'.strtoupper($teerefone).' TEE</td><td> </td>';			}		else			{			echo '<td> </td><td> </td>';			}					}//end for 1					echo '</tr>';	?>  <tr class="header"><td style="width:40px; text-align: center;">TIME</td><?php		for ($i=0;$i<$total_col;$i++)//add fullname and h/cap header			{			echo '<td class="fullname">FULL NAME</td><td class="hcap">H/CAP</td>';			}			?>	</tr><?php		$col_count=0;		} //end if (1)				if($col_count==0)	  {		if($trcount == ceil($rowsarray[$current_table_count]/4) || $trcount == (ceil($rowsarray[$current_table_count]/4)+ceil($rowsarray[$current_table_count]/4)*2))			{			$timestamp=strtotime($_POST['1rowtime']);			$timeinterval=$trgroupcount*$teeperiod;			$teetime=date('H:i', strtotime("+$timeinterval minutes", $timestamp));			$trgroupcount++;			echo '<tr class="starter"><td>'.$teetime.'</td>';			for ($i=0;$i<$total_col;$i++)				{				echo '<td class="fullname">STARTER</td><td class="hcap"> </td>';				}			echo '</tr>';			}		else			{			if($trcount  % ((ceil($rowsarray[$current_table_count]/4)*2)) ==0 && $trcount!=0)				{								for($j=0;$j<2;$j++)					{					if($j==0)						{						$bordtop=" bordertop";						}					else						{						$bordtop="";						}					 echo '<tr class="blank'.$bordtop.'"><td> </td>';					for ($i=0;$i<$total_col;$i++)						{						if($i == 0 && $j !=0)							{							$trgroupcount=0;							$teetexterror="";							if($teereftwo==$teerefone)							{							$teetexterror="highlight_tee_error";							$teereftwo="Matching Tee holes";							}														echo '<td style="font-weight:bold; text-align:center;"><span class="'.$teetexterror.'">'.strtoupper("$teereftwo").'</span> TEE</td><td> </td>';							}						else							{							echo '<td> </td><td> </td>';							}						}			echo '</tr>';					}				}			}			$timestamp=strtotime($_POST['1rowtime']);			$timeinterval=$trgroupcount*$teeperiod;			$teetime=date('H:i', strtotime("+$timeinterval minutes", $timestamp));		echo '<tr><td class="time">'.$teetime.'</td>';		$trcount++;		$trgroupcount++;	  }  	  if($col_count % 2 == 0)		   {		$trclass="rowcol1";		}	else		{		$trclass="rowcol2";		}				if($col_count < (ceil($rowsarray[$current_table_count]*$total_col)/$total_col)+1)		{  ?>  <td class="fullname <?php echo $trclass; ?>"><?php echo strtoupper($row['name']); ?>, <?php echo strtoupper($row['surname']); ?></td>		<td class="hcap <?php echo $trclass; ?>"><?php echo $row['my_handicap_is']; ?></td><?php  }		  $col_count++;		   if($col_count==$total_col)			  {			  echo "</tr>";			  $col_count=0;			  } 			$currentclub = $row['i_wish_to_play'];	   }//end while loop          if($col_count<$total_col && $col_count!=0 && $currentclub !="") /// use to fill empty cells		   {		   for($i=$col_count;$i<$total_col;$i++)			   {			   echo "<td> </td><td> </td>";			   }		   echo "</tr>";		}		fillemptygrouprows($trcount,$total_col, ceil($rowsarray[$current_table_count]));	?></table></div></body></html>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...