Jump to content

nested fetch array


x_maras

Recommended Posts

Hi,

 

I include the code here:

<?php
include("connection.php");
echo "<html>
		<head>
			<title>nieuwsbrief</title>
		</head>
		<body>";

echo "		<table border='1'>
				<tr>
					<th>Version</th><th>link</th><th>clicks</th>
				</tr>";

$query1="SELECT DISTINCT nieuwsbrief_versie FROM nieuwsbrief";
$result=mysql_query($query1);


while($versie=mysql_fetch_array($result)){
	echo "<tr>
			<td>".$versie[0]."</td>
		  </tr>";

	$query2="SELECT DISTINCT link FROM nieuwsbrief WHERE nieuwsbrief_versie= ".$versie[0];
	$result2=mysql_query($query2);

	/*
	while($link=mysql_fetch_array($result2){
		$query3="SELECT COUNT(*) FROM nieuwsbrief WHERE nieuwsbrief_versie= ".$versie[0]." AND link= ".$link[0];
		$result3=mysql_query($query3);

		while($counter = mysql_fetch_array($result3)){
			echo "<tr>
					<td></td>
					<td>".$link[0]."</td><td>".$counter[0]."</td>";
			echo "</tr>";
		}

	}
	*/
}

echo "		</table><br />";

echo "	</body>
	  </html>";
?>

 

It shows results for the first query like this.

If I remove the comments does nothing not even an error or warning.

 

I think that the problem is in the nested while where I use a mysql_fetch_array when I already have one, but I m not sure.

Link to comment
https://forums.phpfreaks.com/topic/151716-nested-fetch-array/
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.