If duplicate entry in database, only show one

Hello,

The code below I am using to display information in a database.  If there is a duplicate entry like say same first and last name (firstname/lastname fields), what do I need to add so only one is displayed?

Thank you
/*** Set rotation of row colors, first a counter ***/
$i=0;
/*** the CSS class names ***/
$colors = array('dark', 'light');
 
// Connect to database
		$dbhost = 'localhost';
		$dbuser = 'xxx';
		$dbpass = 'xxx';
		$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
 
		$dbname = 'tt-marketing';
		mysql_select_db($dbname, $conn);
		$result = mysql_query("SELECT * FROM customers ORDER BY country");
		$data=array();
		if( mysql_num_rows($result) > 0 )
		{
			while($row = mysql_fetch_array($result))
  			{
    			$data[]=$row;
  			}
		}
 
		foreach($data as $v){
		
		echo "<TR class='gridview_".$colors[$i++ % 2]."'><TD>".$v['country']."</TD><TD>".$v['firstname']."</TD><TD>".$v['lastname']."</TD><TD>".$v['company']."</td><td>".$v['street']."</TD><TD>".$v['city']."</TD><TD>".$v['state']."</TD><TD>".$v['zip']."</TD><TD><a class=\"normal\" href='mailto:".$v['email']."'>".$v['email']."</a></TD><TD>".$v['phone']."</TD><TD>".$v['optin']."</TD></TR>";
 
		}
		mysql_close($conn);

Open in new window

vrmetroAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nanharbisonCommented:
change line 14 to:

$result = mysql_query("SELECT * FROM customers ORDER BY country limit 1");

Open in new window

0
nanharbisonCommented:
wait, do you mean you want to show a lot of rows in the table, but only one if the same first and last names are the same?
0
Cornelia YoderArtistCommented:
SELECT * FROM customers GROUP BY LastName, FirstName ORDER BY country
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vrmetroAuthor Commented:
Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.