Jump to content

Archive


onthespot

Recommended Posts

This would not appear to be an sql problem.

So thats why i have placed it in the php forum

 

$archive2="SELECT comp FROM confirmedresults WHERE home_user = '$suser' OR away_user = '$suser'";
$archq2=mysql_query($archive2);
    while($row=mysql_fetch_assoc($archq2)){
        $comp_name2=$row['comp'];
       
    }
$archive="SELECT * FROM archive WHERE comp_name = '$comp_name2' ";
$archq=mysql_query($archive);
$num_rows = mysql_num_rows($archq);
echo $num_rows;

 

The $num_rows is coming back at 0.

I have checked the sql and it works.

I have echoed $comp_name2 and that comes back with what i would expect.

So somewhere the comp_name = '$comp_name2' isnt working.

Its not bringing back what i want.

Have you come across anything like this before?

Link to comment
https://forums.phpfreaks.com/topic/176817-archive/
Share on other sites

<?

$archive2="SELECT comp FROM confirmedresults WHERE home_user = '$suser' OR away_user = '$suser'";
$archq2=mysql_query($archive2);
while($row=mysql_fetch_assoc($archq2)){
	$comp_name2=$row['comp'];

}
$archive="SELECT * FROM archive WHERE comp_name = '$comp_name2' ";
$archq=mysql_query($archive);
$num_rows = mysql_num_rows($archq);
echo $num_rows;
if ($num_rows > 0)
{
?>
<table cellspacing="10">
<tr>
	<td>Competition Name</td>
	<td>Game</td>
	<td>Format</td>
</tr>
<?
	while($row=mysql_fetch_assoc($archq)){
		$comp_name=$row['comp_name'];
		$comp_game=$row['game'];
		$comp_format=$row['format'];
		{
		extract($row);
		$info = explode("_",$row[comp_name]);

?>

<tr>
	<td><a href="league.php?comp=<? echo $comp_name ?>"><? echo $info[2]; ?></a></td>
	<td><? echo $comp_game; ?></td>
	<td><? echo $comp_format; ?></td>
</tr>


<?			}

	}
	?>
	</table>
	<?
}
else
{
	echo "$suser doesn't currently have any archived competitions";
}


?>

 

How can i make the join work on that?

I tried and i got no results at all, not even any rows, didnt even echo 0 rows when i tried!

Link to comment
https://forums.phpfreaks.com/topic/176817-archive/#findComment-932307
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.