edgarperez
02-21-2005, 05:46 PM
I have two tables.
one has a list of drivers from 2004 and the second for 2005
I want to display a list of drivers that are in the 2004 list but no in the 2005 list. In other works, who participated in 2004 that is not partcipating in 2005.
I am trying to use a join of the two tables where a number in 2004 is not in the 2005 table.
code is this
$sqlquery = mysql_query("SELECT * FROM 2004_points a where a.race_number not in (select b.race_number from 2005_points b)" ,$db);
echo ("<table border ='0' align='center' class='main'cellpadding='2' cellspacing='0'>" );
echo ("<tr align='center' valign='bottom' class='sideboxexleftalign'>
<th><a href='2005drivers.php?columnName=race_number'>No.</a>
<th><a href='2005drivers.php?columnName=first_name'>First Name</a>
<th><a href='2005drivers.php?columnName=last_name'>Last Name</a>
<th><a href='2005drivers.php?columnName=hometown'>City</a>
<th><a href='2005drivers.php?columnName=state'>State</a>
<th><a href='2005drivers.php?columnName=year'>Year</a>
<th><a href='2005drivers.php?columnName=club'>Club</a>
<th><a href='2005drivers.php?columnName=total&SortOrder=DESC'>Points</a></tr>");
while ($tablerows = mysql_fetch_row($sqlquery))
{
echo("<tr valign='middle' ONMOUSEOVER=this.bgColor='#000000'; ONMOUSEOUT=this.bgColor='#333333';>
<td valign='top'>$tablerows[0]</td>
<td valign='top'>a.$tablerows[1]</td>
<td valign='top'>a.$tablerows[2]a.$tablerows[8]</td>
<td valign='top'>a.$tablerows[3]</td>
<td valign='top' class='sideboxes'>a.$tablerows[6]</td>
<td valign='top' class='sideboxes'>a.$tablerows[4]</td>
<td valign='top' class='sideboxes'>a.$tablerows[5]</td>
<td valign='top' class='sideboxes'>a.$tablerows[20]</td>");
}
My error is this
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/corvett1/public_html/2005driversnotsigned.php on line 36
Line 36 contains
while ($tablerows = mysql_fetch_row($sqlquery))
one has a list of drivers from 2004 and the second for 2005
I want to display a list of drivers that are in the 2004 list but no in the 2005 list. In other works, who participated in 2004 that is not partcipating in 2005.
I am trying to use a join of the two tables where a number in 2004 is not in the 2005 table.
code is this
$sqlquery = mysql_query("SELECT * FROM 2004_points a where a.race_number not in (select b.race_number from 2005_points b)" ,$db);
echo ("<table border ='0' align='center' class='main'cellpadding='2' cellspacing='0'>" );
echo ("<tr align='center' valign='bottom' class='sideboxexleftalign'>
<th><a href='2005drivers.php?columnName=race_number'>No.</a>
<th><a href='2005drivers.php?columnName=first_name'>First Name</a>
<th><a href='2005drivers.php?columnName=last_name'>Last Name</a>
<th><a href='2005drivers.php?columnName=hometown'>City</a>
<th><a href='2005drivers.php?columnName=state'>State</a>
<th><a href='2005drivers.php?columnName=year'>Year</a>
<th><a href='2005drivers.php?columnName=club'>Club</a>
<th><a href='2005drivers.php?columnName=total&SortOrder=DESC'>Points</a></tr>");
while ($tablerows = mysql_fetch_row($sqlquery))
{
echo("<tr valign='middle' ONMOUSEOVER=this.bgColor='#000000'; ONMOUSEOUT=this.bgColor='#333333';>
<td valign='top'>$tablerows[0]</td>
<td valign='top'>a.$tablerows[1]</td>
<td valign='top'>a.$tablerows[2]a.$tablerows[8]</td>
<td valign='top'>a.$tablerows[3]</td>
<td valign='top' class='sideboxes'>a.$tablerows[6]</td>
<td valign='top' class='sideboxes'>a.$tablerows[4]</td>
<td valign='top' class='sideboxes'>a.$tablerows[5]</td>
<td valign='top' class='sideboxes'>a.$tablerows[20]</td>");
}
My error is this
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/corvett1/public_html/2005driversnotsigned.php on line 36
Line 36 contains
while ($tablerows = mysql_fetch_row($sqlquery))