<p>Is it possible to insert a row, but only if one of the values already in the table does not exist?</p>

<p>I'm creating a <em>Tell A Friend</em> with referral points for an ecommerce system, where I need to insert the friend's email into the database table, but only if it doesn't already exist in the table. This is because I don't want any more than 1 person getting the referral points once the new customer signs up and purchases something. Therefore I want only one email ever once in the table.</p>

<p>I'm using PHP 4 and MySql 4.1.</p>

I'm not sure if I got it, but what about a
```
```
try {
  mysql_query($sql);
}
catch(Exception $e) {

}
```
```
combined with an unique field index in MySQL?
if it throws an exception then you know that you got a duplicated field.
Sorry if that don't answer your question..