0

Hello!
I am fetching some names from MySQL and i want to remove duplicated strings.

Currently got this code:

function get_PublicAlbums(){
$sql = "SELECT * FROM `ue-userfile` WHERE public=1";
$result = mysql_query($sql);
$html = "";
while($row = mysql_fetch_array($result))
   {
	$albumname = $row['albumname'];
	
	
	$html .= '<p><a href="index.php?page=public-albums&an='.$albumname.'">'.$albumname.'</a></p><br/>';
	
   }
/* It might be more than one $row['albumname'](Nature) so i only want to show one of them.
I need some help on that logic, i might be dumb. */
 return $html;

}

Regards,
Morten(Norway)

Edited by Sorcher: n/a

2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by Sorcher
0

I will try that as soon as i get home. I appreciate the replys, thanks! :D

0
$sql = "SELECT DISTINCT albumname FROM `ue-userfile` WHERE public=1

Didn't work in this case, this is what albumname looks like in the db.
albumname | varchar(20)

and it look something like this inside.
Nature
Nature
Nature
Family
Family
Family

I know how i can do this in flat-file .txt organizing but i wanted this one from the DB.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.