Multiple insert bad query?

I have the column name in my database, that is set to be unique

My insert method is like:

( There can be up to 10 tags )

foreach($tags as $tag){
        $test = new BlogsTags();
        $test->name = $tag;

If the tags exists in the database it will be ignored, becuase it's set to be unique, is this bad?

If a row with the same name constraint already exist, RDBMS will raise an error since you have UNIQUE index on. I.e. your foreach query will just stop further execution as RDBMS error will trigger PDOexception. In other words, you need to handle such situations and to catch exceptions in order to decide whenever you will continiue your loop or not.