I think I know what is the porblem !
these lines always return false !
so after this IF statment you are asking to excute $sql which wasn't declared because of this IF statment !
so I suggest you change these lines into:
this one should work !
also I suggest that you don't close the IF statment just after you declare the variable sql, instead close it at the end of the script to avoid useless processing when $_POST['artist'] is not set !
my suggestion is to change it to this: