如何检查数组中的哪些值在MySQL中?

I have an array of values that I want to check to see if it is in the database already. This array can grow upto 100 elements. What's the best way to check it? Should I pull all the table data and then check against it? Should/Can I do this in 1 SQL statement? If so, how? I'm using PHP.

Edit:

I should add that I am checking to see which ones are in the database so then I can add the ones that aren't in there. Maybe there's a better solution than what I was thinking.

I am assuming PHP

$sql = "SELECT name FROM tablename WHERE name IN ('".implode("','", $array_of_names)."')";

Create a statement dynamically like this:

select *
from table
where value in (3, 5, 8, 12, 17, (etc))

produce the list of values from the array in whatever language you are using.