surion Posted October 16, 2007 Share Posted October 16, 2007 hi, i m pretty sure this already exists, tough i just don't find it. what i m looking for is a script that can search for a value trough an entire database, not depending on table names or field names. for example lets say i have "a database", i do not know what fields or tables are in there. i know somewhere there is a field with the value "blablabla", the code should return a tablename and a fieldname where the value "blablabla" was found Link to comment https://forums.phpfreaks.com/topic/73491-search-trough-entire-database/ Share on other sites More sharing options...
kpesanka Posted October 16, 2007 Share Posted October 16, 2007 You'd want to start with a SHOW TABLES, then loop through the resulting tables and do a DESCRIBE on each. Dump the table names and fields into a 2d array, and then loop through each table and do SELECT count(*) FROM $tableName WHERE $fieldName = $value. Make sense? It should be pretty straightforward. Not sure if there is a more efficient way of doing it, but that should certainly work. Link to comment https://forums.phpfreaks.com/topic/73491-search-trough-entire-database/#findComment-370853 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.