While your last comment was quite rude, it looks like you're trying to find out how to name a variable based on another variable's value. Here is the answer to that question: http://php.net/manual/en/language.variables.variable.php The fact still remains that your DB design is bad and should be reworked.
Not php related, but what would be a good c++ book for someone wanting to refresh on basic c++ stuff and learn more? I took a c++ class back in high school but I've since forgotten a bunch of it (not that I learned that much in a single semester). So I know basic c++ stuff (syntax, how functions work, etc etc), now I wish to go from there and into GUI applications. Any suggestions?