Again, per the style guide - curly braces must be on their own new line. And really, you should just do `if ($this->db->query($query))` ... it's pointless to assign the result. Even if you keep the foreign_key_checks lines - they're better off before and after the foreach, not in it.