PHP is always a solution but then add UNIQUE in combination of 2 fields.

Check http://dev.mysql.com/doc/refman/5.1/...ate-table.html

A UNIQUE index creates a constraint such that all values in the index must be distinct. An error occurs if you try to add a new row with a key value that matches an existing row. For all engines, a UNIQUE index permits multiple NULL values for columns that can contain NULL.