Having been through the excellent PHP / MySQL tutorial at webmasterbase.com, I'm now dangerous.

Have a table "Categories" in my MySQL database, which has two columns; ID (INT NOT NULL AUTO_INCREMENT PRIMARY KEY), Category (TEXT).

From a PHP form, want to prevent duplicate entries in the Category column (i.e. the same text string) being inserted into the table.

From the PHP form, the MySQL command I'm using is;

"INSERT INTO Categories SET Category=$cat"

where $cat is a PHP variable.

Is there a way to enhance this command to get it to ignore the INSERT if there is already an entry with the same string as $cat?

Have tried;

"INSERT IGNORE INTO Categories SET Category=$cat"

but this doesnt work (my guess because it checks for a duplicate ID value as well ? ).

Many thanks.