This content has been marked as final. Show 2 replies
Open the database, then use SHOW TABLES method to get the table you need. You may do this in a loop through all the databases, saving the results in an array or other temporary way. If, then, the array contains what you are looking for, then open it. Else ignore it.
If there's a situation where you don't know what database you're connecting to, you have a serious flaw in your design.
And eventually the code will fail anyway when trying to access non-existing elements.
So double checking for the correct database is pretty much unneeded.