Hi,
I want to display a table in a specific way.
Matchnames(Wedstrijdnaam) as toprow
Firstname + Lastname in second column
Perc in crosscell
Like:
"Empty Cell" | Match1 | Match2 | Match3
Firstname+Lastname | Perc (for this match) | Perc | -- (when there's no score for this match
Here's the script I use now, this displays everything vertically.
Thanks in advance !
I want to display a table in a specific way.
Matchnames(Wedstrijdnaam) as toprow
Firstname + Lastname in second column
Perc in crosscell
Like:
"Empty Cell" | Match1 | Match2 | Match3
Firstname+Lastname | Perc (for this match) | Perc | -- (when there's no score for this match
Here's the script I use now, this displays everything vertically.
Thanks in advance !
Code:
<?php
require_once('../../Connections/ASN.php'); ?>
<?php
error_reporting(E_ALL);
mysql_select_db($database_ASN, $ASN);
$query="SELECT `wedstrijd`.`Naam` AS `Wedstrijd`,`klasse`.`Klasse`,`overzicht`.`Voornaam` AS `Voornaam`,`deelnemer`.`Naam` AS `Achternaam` , `overzicht`.`Percentage` AS `Perc` FROM `overzicht` INNER JOIN `deelnemer` ON (`overzicht`.`DeelnemerId` = `deelnemer`.`Id`) INNER JOIN `wedstrijd` ON (`overzicht`.`WedstrijdId` = `wedstrijd`.`Id`) INNER JOIN `klasse` ON (`overzicht`.`KlasseId` = `klasse`.`Id`) WHERE (`klasseID` = 1)";
$result = mysql_query ($query)
or die ("Query failed");
// printing HTML result
print "<table>\n";
$cnt = 0;
while ($line = mysql_fetch_assoc($result)):
print "\t<tr>\n";
if ($cnt === 0):
foreach ($line as $key=>$val):
echo "<td>$key</td>";
endforeach;
echo "</tr><tr>";
$cnt++;
endif;
foreach ($line as $val):
print "\t\t<td>$val</td>\n";
endforeach;
print "\t</tr>\n";
endwhile;
print "</table>\n";
?>