The database structure you have chosen does not lend itself well to doing this kind of thing with MySQL (or any SQL for that matter).
Yes, you could do it in PHP, but since you will want to use JS to do the show/hide blocks you might as well do it all in JS.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.