brob Posted February 5, 2007 Share Posted February 5, 2007 I'm pulling a query from a database and want to check to see if there are any duplicates. I don't want to remove the duplicates but display the id of them. Does anyone know how to do this? Thanks Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted February 5, 2007 Share Posted February 5, 2007 Well, to check for duplicates I'd use mysql_num_rows. As for displaying the id, a loop through them is the only method I know about. <?php //connect... //query if(mysql_num_rows($result) > 1) { //display ids while($data = mysql_fetch_array($result)) { echo $data['id']; } } else { } ?> Quote Link to comment Share on other sites More sharing options...
phat_hip_prog Posted February 5, 2007 Share Posted February 5, 2007 Here's a little ref, look at the replies: http://uk2.php.net/manual/en/function.array-unique.php 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.