If duplicate entry in database, only show one


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 ***/
/*** 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");
		if( mysql_num_rows($result) > 0 )
			while($row = mysql_fetch_array($result))
		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>";

Open in new window

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.

change line 14 to:

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

Open in new window

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?
Cornelia YoderArtistCommented:
SELECT * FROM customers GROUP BY LastName, FirstName ORDER BY country

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
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

From novice to tech pro — start learning today.