Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2003
    Posts
    225

    Unanswered: Border around my records....

    right i have been playing with this allday, but am starting to pull my hair out...

    here is what i have so far!

    http://www.chimp.cc/Players/RTFCPlayers.php

    you will notice that the Donald duck photo at the bottom is in a border and thats what i want for all the records, still dont's get why the records are shown as before also, and Doanld is shown twice?

    latest snippet of code is as follows

    Code:
    <html>
    <title>RTFC Players 2006/07</title>
    
    <? 
    $username="root"; 
    $password=""; 
    $database="Players"; 
    mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); 
    $query="SELECT * FROM players"; 
    $result=mysql_query($query); 
    $num=mysql_numrows($result); 
    mysql_close(); 
    echo "<b><h1><center>Season 2006/07 Squad</center></h1></b><br><br>"; 
    $i=0; 
    while ($i < $num) { 
    $Forename=mysql_result($result,$i,"Forename"); 
    $Surname=mysql_result($result,$i,"Surname"); 
    $DOB=mysql_result($result,$i,"DOB"); 
    $Nickname=mysql_result($result,$i,"Nickname"); 
    $Photo=mysql_result($result,$i,"Photo");
    $RegNo=mysql_result($result,$i,"RegNo"); 
    $Comments=mysql_result($result,$i,"Comments"); 
    $Position=mysql_result($result,$i,"Position"); 
    $GamesPlayed=mysql_result($result,$i,"GamesPlayed"); 
    $GoalsScored=mysql_result($result,$i,"GoalsScored");
    
    if(trim($Photo)!="") $Photo="<img src=\"$Photo\" border=\"0\" alt=\"Select this for a more detailed image\">";
    else $Photo="<img src=\"http://uxellaleague.com/images/teams_200506/awaiting_teampic.gif\" border=\"0\" alt=\"Select this for a more detailed image\">";
    
    echo "<b>$Forename$Surname</b><br>Date Of Birth: $DOB<br>Nickname: $Nickname<br>Photo: $Photo<br>Reg No: $RegNo
    <br>Comments: $Comments<br>Position: $Position<br>Games Played: $GamesPlayed<br>Goals Scored: $GoalsScored <br> <br><hr><br>"; 
    $i++; 
    } 
    echo "<table style=\"border:1px solid #999999;\" cellspacing=\"3\" cellpadding=\"5\" width=\"70%\" align=\"center\" border=\"0\">";
            echo "<tr>";
            echo "<td><b>Name:</b></td>";
            echo "<td>$Forename$Surname</td>";
            echo "</tr><tr>";
            
            echo "<td><b>Date Of Birth</b></td>";
            echo "<td>$DOB</td>";
            echo "</tr><tr>";
            
            echo "<td><b>Photo</b></td>";
            echo "<td>$Photo</td>";
            echo "</tr><tr>";
            
            echo "<td><b>Reg No</b></td>";
            echo "<td>$RegNo</td>";
            echo "</tr><tr>";
            
            echo "<td><b>Comments</b></td>";
            echo "<td>$Comments</td>";
            echo "</tr><tr>";
    
            echo "<td><b>Position</b></td>";
            echo "<td>$Position</td>";
            echo "</tr><tr>";
            
            
            echo "<td><b>Games Played</b></td>";
            echo "<td>$GamesPlayed</td>";
            echo "</tr><tr>";
            
            echo "<td><b>Goals Scored</b></td>";
            echo "<td>$GoalsScored</td>";
            echo "</tr>";
        echo "</table>";
        echo "<br><br>";
    ?>
    </html>
    Please help

    Cheers

    Andy

  2. #2
    Join Date
    Apr 2006
    Location
    Denver, Co. USA
    Posts
    242
    Your code is echo'ing the individual information in the while loop, the while loop ends, then your table code outputs the last data in the table one more time.

    In your code, this is the end of your while loop -
    PHP Code:
    echo "<b>$Forename$Surname</b><br>Date Of Birth: $DOB<br>Nickname: $Nickname<br>Photo: $Photo<br>Reg No: $RegNo
    <br>Comments: 
    $Comments<br>Position: $Position<br>Games Played: $GamesPlayed<br>Goals Scored: $GoalsScored <br> <br><hr><br>"
    $i++; 
    }  
    // <----------------- this is the end of the while loop ---------------
    // the code above this is outputing all the data without a table
    // the code after this is outputing the last set of data a second time, but in the table
    echo "<table style=\"border:1px solid #999999;\" cellspacing=\"3\" cellpadding=\"5\" width=\"70%\" align=\"center\" border=\"0\">"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •