My teams.php loops thru all the teams in the database and displays them as links.
Below is teams.php
This all seems to work fine.
Below is members.php
That seems to be working fine except for the fact that every link in teams.php when clicked goes to the first team in the database rather then the second team querying the data from id=2. Im sure theres some easy explainaton to all this, but im rather new to all this stuff and still trying to learn, any help would be appeciated. btw the link to my site is http://www.chaotic-tdm.com and if you click teams then click the teams in the list you'll see what I mean.
Below is teams.php
PHP Code:
<?php
require("config.php");
$conn = mysql_connect($dbhost, $dbuname, $dbpass) or die("Could not connect to database!");
mysql_select_db($dbname, $conn);
$conn = mysql_query("SELECT id, team FROM teams");
if ($myrow = mysql_fetch_array($conn))
{
echo "<div align=\"left\">
<center>
<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\" width=\"520\">
<tr>
<td align=\"center\">Teams List</td>
<tr>
<td><hr noshade size=\"1\" color=\"#0E3F6A\" width=\"80%\" align=\"center\"></hr><br></td>
</tr>
</table>
</center>
</div>";
do
{
?>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="520" height="15">
<tr>
<td width="20%" height="15" align="center" valign="top">
<p align="center"><a href="?page=members&id=<?php echo $myrow['id']; ?>"><?php echo $myrow['team']; ?></a></td>
</tr>
</table>
</body>
<?php
} while ($myrow = mysql_fetch_array($conn));
}
else
{
echo "<div align=\"center\">\n" ;
echo " <center>\n" ;
echo " <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"526\">\n" ;
echo " <tr>\n" ;
echo " <td align=\"center\">No Teams Yet</td>\n" ;
echo " </tr>\n" ;
echo " </table>\n" ;
echo " </center>\n" ;
echo "</div>" ;
}
?>
Below is members.php
PHP Code:
<?php
require("config.php");
$conn = mysql_connect($dbhost, $dbuname, $dbpass) or die("Could not connect to database!");
mysql_select_db($dbname, $conn);
$conn = mysql_query("SELECT * FROM teams");
if ($myrow = mysql_fetch_array($conn))
?>
<table width='100%' border='0' bordercolor='#000000' cellspacing='0' cellpadding='0'>
<tr>
<td width='50%' valign='top' align='left'>
<table width='100%' border='0' bordercolor='#000000' cellspacing='1' cellpadding='1'>
<tr>
<td width='100%' valign='center' align='center' colspan='2'>
<strong>Team Information</strong></td>
</tr>
<tr>
<td width='40%' valign='center' align='left'>Name</td>
<td width='60%' valign='center' align='left'><?php echo $myrow['team']; ?></td>
</tr>
<tr>
<td width='40%' valign='center' align='left'>Captain</td>
<td width='60%' valign='center' align='left'><?php echo $myrow['captain']; ?></td>
</tr>
<tr>
<td width='40%' valign='center' align='left'>Location</td>
<td width='60%' valign='center' align='left'><?php echo $myrow['irc']; ?></td>
</tr>
<tr>
<td width='50%' valign='bottom' align='left'>Email</td>
<td width='50%' valign='bottom' align='left'><a href="mailto:<?php echo $myrow['email']; ?>">Click</a></td>
</tr>
</table>
</td>
<td width='50%' height='100%' valign='top' align='right'>
<table width='100%' height='100%' border='0' bordercolor='#000000' cellspacing='1' cellpadding='1' bgcolor=''>
<tr>
<td width='100%' height='100%' valign='top' align='center'><img src='<?php echo $myrow['picture']; ?>' border='0'></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
Comment