Sorry to post so much code all at once but I'm banging my head against
the wall trying to get this to work!
Does anyone have any idea where I'm going wrong?
Thanks in advance and sorry again for adding so much code...
<TABLE border="1" bordercolor="#000000" cellspacing="0">
<TR>
<TD>
<?php
include("misc.inc");
$connection = mysql_connect($host,$user,$password)
or die ("Couldn't connect to the server");
$db = mysql_select_db($database,$connection)
or die ("Couldn't select the database");
/* based upon the selection from the drop-down list, select the
player's basic details and format his
birthdate to the english format */
$query = "SELECT *, DATE_FORMAT(birthdate, '%d/%m/%y') AS birth FROM
player WHERE playerid='{$_POST['interest']}'";
$result = mysql_query($query)
or die ("Couldn't execute query");
$row = mysql_fetch_array($result);
/* again, based upon the selection from the drop-down list, select
all the player's historical details from
the playerhistory table ensuring the date joined is in the english
format */
$query2 = "SELECT *, DATE_FORMAT(joined, '%d/%m/%Y') AS joined FROM
playerhistory WHERE playerid='{$_POST['interest']}'";
$result2 = mysql_query($query2)
or die ("Couldn't execute query2");
$row2 = mysql_fetch_array($result2);
/* This selects all records from player appearances table and links
with playerhistory table
$query3 = "SELECT * FROM playerapps LEFT JOIN playerhistory ON
playerapps.playerhistid = playerhistory.playerhistid";
$result3 = mysql_query($query3)
or die ("Couldn't execute query3");
$rows3 = mysql_fetch_array($result3);
$nrows3 = mysql_num_rows($result3);
/* display the results in a table */
print "<TABLE border='1' bordercolor='#000000' width='800'
class='table'>\n";
print "<tr valign='top'>\n";
printf ("<td width='90'><b>%s</b>\n",$row['forename']);
printf ("<b>%s</b></td>\n",$row["surname"]);
print "<td width='70'></td>\n";
print "<td width='70'></td>\n";
print "<td width='70'></td>\n";
print "<td width='70'></td>\n";
print "<td width='70'></td>\n";
print "<td width='70'></td>\n";
print "</tr>\n";
print "<tr>\n";
print "<td>BIRTHDATE:</td>\n";
printf ("<td>%s</td>\n",$row["birth"]);
print "</tr>\n";
print "<tr>\n";
print "<td>BIRTHPLACE:</td>\n";
printf ("<td>%s</td>\n",$row['birthplace']);
print "</tr>\n";
print "<tr>\n";
print "<td>NATIONALITY:</td>\n";
printf ("<td>%s</td>\n",$row['nationality']);
print "<tr>\n";
print "<tr>\n";
print "<td>POSITION:</td>\n";
printf ("<td>%s</td>\n",$row['position']);
print "</tr>\n";
print "</TABLE>\n";
print "<TABLE border='1' bordercolor='#000000' width='700'
class='table'>\n";
print "<tr align='center' class='heading'>\n";
print "<td bgcolor='#000066' width='70'>JOINED</td>\n";
print "<td bgcolor='#000066' width='70'>FROM</td>\n";
print "<td bgcolor='#000066' width='70'>TO</td>\n";
print "<td bgcolor='#000066' width='70'>VALUE</td>\n";
print "<td bgcolor='#000066' width='70'>FULL APPS</td>\n";
print "<td bgcolor='#000066' width='70'>SUB APPS</td>\n";
print "<td bgcolor='#000066' width='70'>GOALS</td>\n";
print "<td bgcolor='#000066' width='70'>RED CARDS</td>\n";
print "<td bgcolor='#000066' width='70'>YELLOW CARDS</td>\n";
print "</tr>\n";
while ($rows3 = mysql_fetch_array($result3))
{
print "<tr align='center'>\n";
printf ("<td width='70'>%s</td>\n",$row2['joined']);
printf ("<td width='70'>%s</td>\n",$row2['goals']);
printf ("<td width='70'>%s</td>\n",$row2['toclub']);
printf ("<td width='70'>%s</td>\n",$row2['boughtfor']);
print "</tr>\n";
if ($nrows3 == 1)
{
printf ("<td width='70'>%s</td>\n",$rows3['apps']);
printf ("<td width='70'>%s</td>\n",$rows3['subapps']);
printf ("<td width='70'>%s</td>\n",$rows3['goals']);
printf ("<td width='70'>%s</td>\n",$rows3['redcards']);
printf ("<td width='70'>%s</td>\n",$rows3['yellowcards']);
print "</tr>\n";
}
else
{
while ($rows3 = mysql_fetch_array($result3))
{
printf ("<td width='70'>%s</td>\n",$rows3['apps']);
printf ("<td width='70'>%s</td>\n",$rows3['subapps']);
printf ("<td width='70'>%s</td>\n",$rows3['goals']);
printf ("<td width='70'>%s</td>\n",$rows3['redcards']);
printf ("<td width='70'>%s</td>\n",$rows3['yellowcards']);
print "</tr>\n";
print "<tr>\n";
print "<td></td>\n";
print "<td></td>\n";
print "<td></td>\n";
print "<td></td>\n";
}
}
}
print "</TABLE>\n";
?>
</TD>
</TR>
</TABLE>