sw9 Posted January 7, 2009 Share Posted January 7, 2009 Can anyone tell me how to search an entire database for a specific string? I know I can do REGEX on specific table. But I need to find a string 'get_cma_date' and it could be anywhere in my 255 table DB. Any ideas on how to accomplish this? Thx much! Quote Link to comment https://forums.phpfreaks.com/topic/139854-search-entire-database-for-string/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 7, 2009 Share Posted January 7, 2009 Queries are specific to the table(s) you have written in your query. To search all the tables, you would need to list all of them in the query, either in a UNION or a JOIN. There is no wild-card search across all the tables in a database. Why do you have similar/same information split into 255 different tables? Quote Link to comment https://forums.phpfreaks.com/topic/139854-search-entire-database-for-string/#findComment-731662 Share on other sites More sharing options...
sw9 Posted January 7, 2009 Author Share Posted January 7, 2009 I don't have same data in my tables, the issue is that I need to find WHAT table contains a certain string of PHP code that is causing a problem on my site. I am running drupal, so the error is not coming back in a way that is helping me determine which page is causing the problem. OK, so if I were to use REGEX for this and list out a bunch of tables that could be the culprit, can I get around having to include the specific column? Meaning, can I have it search specific tables in full rather than provide an exact column to try to match on? Quote Link to comment https://forums.phpfreaks.com/topic/139854-search-entire-database-for-string/#findComment-731707 Share on other sites More sharing options...
fenway Posted January 7, 2009 Share Posted January 7, 2009 Not easily... DBs are not really designed for this. Have you looked at Sphinx? Quote Link to comment https://forums.phpfreaks.com/topic/139854-search-entire-database-for-string/#findComment-731739 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.