x_maras Posted March 30, 2009 Share Posted March 30, 2009 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 More sharing options...
Ayon Posted March 30, 2009 Share Posted March 30, 2009 while($link=mysql_fetch_array($result2){ <--- you have forgotten the last ) Link to comment https://forums.phpfreaks.com/topic/151716-nested-fetch-array/#findComment-796716 Share on other sites More sharing options...
x_maras Posted March 30, 2009 Author Share Posted March 30, 2009 this was stupid. But now still can't enter in the third while... Link to comment https://forums.phpfreaks.com/topic/151716-nested-fetch-array/#findComment-796730 Share on other sites More sharing options...
x_maras Posted March 30, 2009 Author Share Posted March 30, 2009 ok now, sql problem Link to comment https://forums.phpfreaks.com/topic/151716-nested-fetch-array/#findComment-796733 Share on other sites More sharing options...
Ayon Posted March 30, 2009 Share Posted March 30, 2009 have you checked that $result3=mysql_query($query3); returns something? Link to comment https://forums.phpfreaks.com/topic/151716-nested-fetch-array/#findComment-796749 Share on other sites More sharing options...
x_maras Posted March 30, 2009 Author Share Posted March 30, 2009 It works but not right (I m trying to fix it now ) For example it shows result form some versions (correct results for these ones), but for some others doesn't. Link to comment https://forums.phpfreaks.com/topic/151716-nested-fetch-array/#findComment-796751 Share on other sites More sharing options...
x_maras Posted March 30, 2009 Author Share Posted March 30, 2009 ok I fixed it! the code above have multiple errors in the sql queries Link to comment https://forums.phpfreaks.com/topic/151716-nested-fetch-array/#findComment-796756 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.