I've got a table and I have a text field with a URL again, I don't want any rows with duplicate URL's but I'd rather not do a check before inserting, is there no way to make a text field unique or could you suggest another field type to use?
You could try using another field that contains a hash of the URL field.
If your text field in the database is set to unique or a primary key or however you have it set up, than an insert statement will fail upon trying to input a duplicate. That way all you should have to do is properly handle the failed insert and there you have it.
As pointed out elsewhere, you can't have an actual TEXT field be unique, but if you are using a varchar field it is doable. This may not be important at all (may just be a miscommunication), because if you are storing URL's in a TEXT field, you have other problems to worry about as well.
It seems you can't make text fields unique, atleast with InnoDB. You could use a varchar field with a length of 767 (this appears to be the max). Then alter the same field to make it unique.
The correct way, is to Check whether the url exists in the table, if yes then insert, else, donot insert.
As a best practice, Exception Handling should be used where it actually requires, it should not be used as a replacement of a normal functions.