DieterDaems Posted October 22, 2009 Share Posted October 22, 2009 For now this is all i got. Because i have no idea, how to prevent outputting the same value. And still continueing the loop. Can anyone help me, or point me in the right direction? with friendly greetings, Dieter $myDb->connect(); $sql = "SELECT * FROM `winelist`, `winemakers` WHERE (`winelist`.`winemakerid` = `winemakers`.`id`) ORDER BY winecountry, winetype, winename_sub, wineyear "; $query = mysql_query($sql) or die("Query failed: " . mysql_error()); $result = mysql_fetch_array($query); $myDb->close(); echo "<h3 class='menuheader expandable'>Per Winemaker</h3>"; echo "<ul class='categoryitems'>"; while ($result = mysql_fetch_array($query)){ $makername = htmlentities($result['makername']); echo "<li><a href='wines.php?winemaker='$makername'>$makername</a></li>"; } echo "</ul>"; Quote Link to comment Share on other sites More sharing options...
jon23d Posted October 22, 2009 Share Posted October 22, 2009 Use DISTINCT or GROUP to make your life easier. Quote Link to comment Share on other sites More sharing options...
purpleshadez Posted October 22, 2009 Share Posted October 22, 2009 Use DISTINCT or GROUP to make your life easier. This would be a slight mod of your SQL statement $sql = "SELECT * FROM `winelist`, `winemakers` WHERE (`winelist`.`winemakerid` = `winemakers`.`id`) GROUP BY fieldName ORDER BY winecountry, winetype, winename_sub, wineyear "; Quote Link to comment Share on other sites More sharing options...
DieterDaems Posted October 22, 2009 Author Share Posted October 22, 2009 thx Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.