Sorry, I wasn't clear enough before - I don't think you need these values at all.
In the two places you do SELECT, just return the value immediately.
In the two places you use IGNORE, just do nothing.
In the one place you use APPEND, just do the append.

These values make it seem more complicated than it really is.