If what you described is the limit of what you need (looking up pairs of strings), I would recommend trying with the dictionary object.
When entering a pair of strings "A" and "B", create a key:value pair in dictionary 1 as "A":"B", and dictionary 2 as "B":"A". When looking up a string, you can check if key exists in either dictionary, and display both values if it does.
Php and MySQL are quite large topics, and I'm sure you can find extensive resources with a quick Google search. I don't have any particular one to recommend.