Forum Moderators: coopster
Sounds like a quick session with some relational database tutorials [google.co.uk] would help clear the fog for you ...
The bigger question is "why are you keeping a unique item number across 3 different databases?" As storevalley alluded, you may want to review relation and normalization.
i thought it would be easier to have a unique value for each of the items...something like eb@y item number
An item could be numbered 12345678 where 1234 means (e.g.) "lighting", and 5678 is a unique ID (automatically generated) for the item.
When the item number is passed to your script, remove the first 4 digits and use them to work out which table to query. Then use the rest of the number as the item ID.