Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specific layout 1

Status
Not open for further replies.

pookie62

Technical User
Oct 22, 2004
139
GB
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 !
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";
?>
 
Morning jpadie,
Wow..! this is fantastic !!
Can't say thank you enough..absolutely super.
Starred you twice !
Thanks for all your time and say "hoi" to your wife from me ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top