hello all i am working on a project where i need to select the field only if it contains any of the values of an array
what i mean is that
i have a string like (comma separated)
$string =1,2,3,4,5,7;
and i have a database which contains a table wtth values like
1,9 // this is one of the field which conatins the id of people who should be notified
now i want to select all the fields which contains any of the value out of the string like
if the string is like
$string =1,7;
and
field contains 1,8
filed2 contains 9,88
field3 contains 2,5,6,7,8
then select only 1 and 3 filds
i have tried this
select aid,a.cid,tdid,fdid,mcat,sub,a.mess,attach,prio,sdate,edate,stime,etime,a.date,d.name,d.photo,c.curl,c.cname
from activity a,dept d,enter c where
((CONCAT(",", tdid, ",") REGEXP ",('.implode("|",$arr).'),") and tdid=d.did and d.acid=c.cid)
$mydeptslist=1,8
$arr=array($mydeptslist);
this code dosent select anything even if the value matches .. please suggest me something else .... i have a dynamic string..