Well, the only problem is, the data will be outputted into a dropdown box, so a loop would cause duplicates of the ID.
Guess I should have mentioned that there are approx 50 ID's and they are not unique. The only way I can think of doing it is something like: $foo = mysql_query($whatever) while ( mysql_fetch_row($foo) ) { if ( $id == 1 ) { $id1_count ++; } if ($id == 2) { $id2_count ++; } } if ($id1_count >=1) { print "This ID"; } But something like that on a larger table will cause problems with server load after time (I'm assuming)... Any other possibilities out there? Thanks again. Justin At 11:17 AM 8/14/2002 +1000, you wrote: > -----Original Message----- > From: Justin [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, 14 August 2002 10:52 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Comparing Data > > > Hello all, > > I've run into a problem and there has got to be a way to do this. > > I'm searching a mysql table and finding all rows that have the > same ID. I need to output that ID, but I only want it to print once. > > Any help would be greatly appreciated! > Justin > what about something like a simple select statement eg SELECT * FROM table where id = $ID; then do something like echo $ID echo $other values. blah blah blah blah with the echo in a loop so it gets all the values.. just a thought.. Cheers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php