Can't get my final if statement to work

@TenDoLLA went above and beyond and wrote a complete solution correcting all the OP’s flawed DB design and code yet OP continues with this junk. There is just no excuse at this point.

TenDoLLA code