php - MySQL: detect if values exists in DB -


I get a list of values ​​like comma separator

  D1, D 2, D3   

I know that each of these values ​​is present in DB or not (check that D1 is present, D2 and D3)

I know that I can send a loop and send a question for "N" DB (but sometimes I get a long list)

Is there any automated way in MySQL to handle it? Or in PHP to match the table:

  ID data 1D 2D3 3D4D5  
< P> Thanks,

Try this:

  from SELECT * WHERE in `data` ('D1', 'D2', 'D3')  

Comments