SHOW TABLES FROM Returns False
I’m working on Easy CSV Importer and I’ve discovered a problem caused by the database name including hyphens. Well at least that is what I’ve read and my database does have hyphens. Using “SHOW TABLES FROM” in MySQL seems to trigger an error as if a hyphened database name is illegal. Strange, others have experienced this also. Your wondering why I don’t just change the database name? Well the problem is, the name is automatically generated so I need a long term solution. Hence why I thought I would post here.
I have tried escaping the query, using WordPress own prepare function, double quotes, single quotes and back-ticks but nothing works. Strange this is, it did work before. It may be new updates to PHP and MySQL recently.
Anyway I need to get back to finding a solution. If you think you have one and it works, I will reward.
Solution Found
Other queries work fine without quotes or backticks around the database name but it seems a SHOW TABLES FROM query needs backticks. I did try backticks already before creating this post so not sure what happened there but never mind. I hope this helps someone else, please let me know below if it has and thank you for visiting WebTechGlobal.