如果存在两个值,则不插入PHP / SQL

I only want to insert if there are no entries where "name" and "email" exist together.

So it's ok if "name" exists with a different e-mail or vica versa.

mysql_query("INSERT INTO list (name,email) VALUES ('$name','$email') ");

I want this done in one SQL statement for bette performance.

Make both the columns (name,email) as composite primary key and use ON DUPLICATE KEY UPDATE to prevent php errors.

make your primary key the pair (name,email).

If you can't make [name, email] as your primary key, set it up as a unique constraint. That way no record with both values matching will be inserted.

Have a primary key on name and email, then do this:

REPLACE INTO list (name,email) VALUES ('$name','$email')

replace is the same as insert, except if the values already exist it will overwrite them.