Hi folks,
I have a page at www.gnjgf.co.za/doom.php
That is duplicating the top two rows.
Can someone please advise as to how I can get it to stop - that is I only want the top two rows to appear once.
Hi folks,
I have a page at www.gnjgf.co.za/doom.php
That is duplicating the top two rows.
Can someone please advise as to how I can get it to stop - that is I only want the top two rows to appear once.
You would have to post you code for me to tell you exactly what to do, however it is just a matter or moving that heading code outside of the loop
Register/Login Script
Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script
Hi,
Please find code attached for your perusal.
When veiwing www.gnjgf.co.za/stevie/doom1.php a grey line appears at the top which says there is some input that is not necessary there.PHP Code:<?php
//------------------------------------------------------------------>
// THIS SECTION CHANGES THE VALUES of <72 TO RED and PAR TO BLUE >
// >
// INCLUDING THIS BELOW echo findNumColor($row['d11']); >
//------------------------------------------------------------------>
function findNumColor($var) {
if(intval($var) < 72) {
return '<font color="Red">'.$var.'</font>';
} elseif(intval($var) == 72) {
return '<font color="Blue">'.$var.'</font>';
} else {
return '<font color="Black">'.$var.'</font>';
}
}
//-------------------------------------------------------------------
$connect = mysql_connect("localhost", "*****_robert", "******") or
die ("Hey loser, check your server connection.");
mysql_select_db("*******_DOOM");
$query="select * from strokeaverage ORDER BY `rank` ASC ";
$result=mysql_query($query) or die(mysql_error());
?>
<!------------------------------------------------------------------>
<! THIS SECTION CHANGES WHAT THE TABLE LOOKS LIKE >
<!------------------------------------------------------------------>
<TITLE></TITLE>
<link rel="StyleSheet" href="style.css" type="text/css">
</HEAD>
<body>
<table width="100%" border="1" cellspacing="0" cellpadding="3" align="center">
<tr align="left" valign="top">
<td class="title">
<table width="100%" border="1" cellspacing="0" cellpadding="0">
</table>
<td>
<tr class="menu-bg"><td colspan=29><b>GAUTENG NORTH JUNIOR GOLF FOUNDATION - DOMESTIC SCORES ONLY</b></td>
</tr>
<tr class="menu-bg"><td><b>RANK</b></td><td><b>FULL NAME</b></td><td>D11</td><td>D12</td><td>D13</td><td>D14</td><td>D15</td><td>D16</td>
<td>D17</td><td>D18</td><td>D19</td><td>D20</td><td>D21</td><td>D22</td><td>D23</td><td>D24</td><td>D25</td><td>D26</td>
<td>D27</td><td>D28</td><td>D29</td><td>D30</td><td>D31</td><td>D32</td>
<td>D33</td><td>D34</td><td>D35</td><td>D36</td>
</tr>
<!------------------------------------------------------------------>
<! THIS SECTION CHANGES THE MAIN HEADING >
<!------------------------------------------------------------------>
<caption><b><font style="font-size:16px" color="#00008B" face="Arial">
<font><b><caption>
<!------------------------------------------------------------------->
<! THIS SECTION FETCHES THE INFORMATION FROM THE MYSQL TABLE >
<!------------------------------------------------------------------->
<?php
$counter = array();
$last_rank = "";
$firstNAsAString = "";
while($row=mysql_fetch_array($result)){
//----------------------------------------------------------------------------------------------------
// THIS SECTION ADDS 3 EMPTY LINES IF THERE IS A SPLIT BUT ONLY AFTER SOME RECORDS HAVE BEEN DISPLAYED
//----------------------------------------------------------------------------------------------------
if($i > 0 AND $row['-rank'] != $last_rank){
echo '<tr>
<td colspan="29"></td>
</tr>';
}
//------------------------------------------------------
// THIS SECTION ADDS HEADINGS
//------------------------------------------------------
if ($row['-rank'] != $last_rank) {
echo '<tr>
<td colspan="29" align="center" bgcolor="#FFFFFF"><font style="font-size:11px" color="#00008B" face="Arial"><b>DOMESTIC STROKE AVERAGES</b></font></td>
</tr>';
echo '<tr>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:8px" color="#00008B" face="Arial"><b>RANK</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:8px" color="#00008B" face="Arial"><b>FULL NAME</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:8px" color="#00008B" face="Arial"><b>D 11</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:8px" color="#00008B" face="Arial"><b>D 12</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:8px" color="#00008B" face="Arial"><b>D 21</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 22</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 31</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 32</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 41</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 42</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 51</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 52</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 61</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 62</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 71</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 72</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 81</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 82</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 91</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D 92</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D101</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D102</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D111</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D112</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D121</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D122</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D131</b></font></td>
<td align="center" bgcolor="#D6D6D8"><font style="font-size:11px" color="#00008B" face="Arial"><b>D132</b></font></td>
</tr>';
}
echo '<tr><td align="center" bgcolor="#FFFFFF"><font style="font-size:10px" color="#00008B" face="Arial">';
echo $row['rank'];
echo '</td><td bgcolor="#FFFFFF"><font style="font-size:10px" color="#00008B" face="Arial">';
echo '<option value="'.$row['surname'].', '.$row['name'].'"><b>'.$row['surname'].'</b>, '.$row['name'].'</option>';
echo '</td><td align="center" bgcolor="#F5F5F5"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d11']);
echo '</td><td align="center" bgcolor="#F5F5F5"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d12']);
echo '</td><td align="center" bgcolor="#FFFFFF"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d21']);
echo '</td><td align="center" bgcolor="#FFFFFF"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d22']);
echo '</td><td align="center" bgcolor="#F5F5F5"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d31']);
echo '</td><td align="center" bgcolor="#F5F5F5"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d32']);
echo '</td><td align="center" bgcolor="#FFFFFF"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d41']);
echo '</td><td align="center" bgcolor="#FFFFFF"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d42']);
echo '</td><td align="center" bgcolor="#F5F5F5"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d51']);
echo '</td><td align="center" bgcolor="#F5F5F5"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d52']);
echo '</td><td align="center" bgcolor="#FFFFFF"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d61']);
echo '</td><td align="center" bgcolor="#FFFFFF"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d62']);
echo '</td><td align="center" bgcolor="#F5F5F5"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d71']);
echo '</td><td align="center" bgcolor="#F5F5F5"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d72']);
echo '</td><td align="center" bgcolor="#FFFFFF"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d81']);
echo '</td><td align="center" bgcolor="#FFFFFF"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d82']);
echo '</td><td align="center" bgcolor="#F5F5F5"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d91']);
echo '</td><td align="center" bgcolor="#F5F5F5"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d92']);
echo '</td><td align="center" bgcolor="#FFFFFF"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d101']);
echo '</td><td align="center" bgcolor="#FFFFFF"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d102']);
echo '</td><td align="center" bgcolor="#F5F5F5"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d111']);
echo '</td><td align="center" bgcolor="#F5F5F5"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d112']);
echo '</td><td align="center" bgcolor="#FFFFFF"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d121']);
echo '</td><td align="center" bgcolor="#FFFFFF"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d122']);
echo '</td><td align="center" bgcolor="#F5F5F5"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d131']);
echo '</td><td align="center" bgcolor="#F5F5F5"><font style="font-size:10px" color="#00008B" face="Arial">';
echo findNumColor($row['d132']);
if($row['i_wish_to_play'] != $last_wish_to_play)
{
// the first n words to extract
$n = 4;
// extract the words
$words = explode(" ", $row['i_wish_to_play']);
// chop the words array down to the first n elements
$firstN = array_slice($words, 1, $n-1);
// glue the 3 elements back into a spaced sentence
$firstNAsAString = implode(" ", $firstN);
}
if(!isset($counter[$firstNAsAString]))
$counter[$firstNAsAString] = 0;
else
$counter[$firstNAsAString]++;
$last_wish_to_play = $row['i_wish_to_play'];
$i++;
echo '</td></tr>';
}
echo '</table>';
?>
I have got rid of the duplication byt still the extra line of gery shows.
Your table structure is off. You have some unused table statements. You can delete the following code to clean up your table structure:
Basically you are not using the table information from the first table declaration below the <body> tag down to the <tr class="menu-bg"> row.Code:<tr align="left" valign="top"> <td class="title"> <table width="100%" border="1" cellspacing="0" cellpadding="0"> </table> <td>
I copied out the HTML output and removed these lines and it looks much better. It's now just a single table and not a nested table like you had before.
Hi,
Again my thanks
It is good to know folk like yourselves
Hi,
Maybe you can help with the next step.
How do i select the 6 lowest values from a row and then divide to get an average - and let this action happen for all rows?
There are currently 1 users browsing this thread. (0 members and 1 guests)