Your very first line of code should be throwing up an error:
echo "<th><select name='A' id='A' onChange='" . theAFunction() . "'>
It isn't finished.
Next <th> is used in tables. Should not be here.
WHERE aye LIKE '%' ...
makes no sense.
Why don't you post the complete code? The html and the php so you can see the problem.
You have to submit a form, that's how html talks to php to update or select information from a database.