MYSQL query over multiple database same host

Hi guys

Looking for help on MYSQL. Basically i have 2 databases on the same host.

1st database has a list of defect types IE… (Plumbing, Electrical , Building) with Unique IDs IE.. 1,2,3,4,5 etc. Second database has the list of all logged defects with multiple fields, one of which is defect types. with the same IDs as above
i need to know how to construct a mysqli query in PHP to do basically the following

if ID from database 1 is equal to ID from Database 2 then print out something

any help appreciated
hope it is clear enough

Why have you used two databases for that? It would make way more sense to use two tables in the same database (which also makes using foreign keys easier).

I have a feeling OP is just misusing the the term “database” and actually just has tables.

OP, If your DB was created properly you should not have any defects logged that are not listed in the defect types. Sounds like there is a problem somewhere else that needs to be resolved first. We need more details on what you have going on.

PHP isn’t really relevant here, though, it’s just a MySQL query, whether it’s across multiple databases or just multiple tables.

Hi guys

thanks for the comments, you were correct i was confused

1 Like

And did you solve your problem?

To be Honest i was trying to fix a coding error on a previous page, but after the awesome help i received i saw the errors of my ways and got sorted

thanks all for the awesome help, its forums like these that give Plebs like me hope :slight_smile:

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.