hello...

i am doing authors page. in this i want to display related authors of that site. in authors table author has a field author type. he can give more types by ',' separate.

so i want to dispaly related authors who has matched his type.

here i wrote my code but displaying many times.
example:
main author type:blues,reds.

another author type reds,greens,blues.

then i am extracting and next using foreachloop like this

$select=mysql_query("select * from authors where id!=$_SESSION[author_id]");
while($fetch=mysql_fetch_array[$select])
{
foreach($mainauthortype as $mauthortype)
{
foreach($fetch[anotherauthortype] as $aauthortype)
{
if(mauthortype==aauthortype)
{
displaying related authors. here displayig same author moretimes. so how can i restrict this.
}
}
}
}

MySQL has the FIND_IN_SET() function, which allows you to search for a value in a column that has a CSV string.

SELECT * FROM authors WHERE FIND_IN_SET('reds', type)