Newbie wants column data without duplication

From: Date: Sun, 12 Aug 2001 18:58:36 +0000
Subject: Newbie wants column data without duplication
Groups: php.db 
Request: Send a blank email to php-db+get-11270@lists.php.net to get a copy of this message
I have only been doing this for a week so be gentle with me :) I have set up a database (in Mysql) which contains details about my sudents. I am able to produce a list of tutor groups so when the user clicks on a tutor group name he/she is taken to a list of all of those students in that tutor group. The problem is the tutor group name is duplicated depending upon how many members it contains. IE If 12 people belong to 7DS then 7DS appears on the list 12 times. Once would be better. Any advice, bits of code or URLs that would contain the answer would be more thatn welcome. My PHP code follows (please don't laugh at it!) echo "Click on a Tutor group to see it's members<br><br>"; $result = mysql_query("SELECT * FROM pupil_details ORDER BY tutor_group",$db); if ($myrow = mysql_fetch_array($result)) { do { printf("<a href=?tutor_group=$myrow[tutor_group]>$myrow[tutor_group]</a><br>\n", $PHP_SELF, $myrow[tutor_group]); } while ($myrow = mysql_fetch_array($result)); } Thanks for your time Darren

« previous php.db (#11270) next »