I don't think column names can have "." in them, so you may want to change them to "_" instead. That could cause huge problems there.
You can do this in multiple queries. I'm not sure about how to do it with one. I know it has to do with joins and such, but I'm not the foremost authority on it. Maybe Sxooter will get around here and answer this for you.
Well, this gets you really close:
SELECT a.code AS code, c.datab_name AS name, b.reference_id AS id
FROM `reference` AS a
INNER JOIN `protein_reference` AS b ON a.reference_id=b.protein_id
INNER JOIN `database` AS c ON a.datab_id=c.datab_id
WHERE a.code='$user_input'
That query outputs this:
AAAA [Yale] 1
AAAA [Yale] 2
AAAA [Yale] 4
Not sure what's going on. Something with the joins. Like I said, I'm not the foremost authority, but that's all I can help you with. THe b.reference_id AS id was just to make sure that I was actually getting different values.
Only thing it doesn't wanna do is write the proper names... not sure why....
~Brett