Added a fix for matching table names

This commit is contained in:
Neil Lathwood
2014-12-19 17:37:15 +00:00
parent 45e3323f38
commit 1df57b7254

View File

@ -80,13 +80,9 @@ if( isset($_GET['term'],$_GET['device_id']) ) {
$chk = $memcache->get('rule-suggest-toplvl');
}
if( !(sizeof($chk) > 0) || $chk === false ) {
$tmp = dbFetchRows('SHOW TABLES');
$tmp = dbFetchRows("SELECT TABLE_NAME FROM information_schema.COLUMNS WHERE COLUMN_NAME = 'device_id'");
foreach( $tmp as $tst ) {
$tbl = array_shift($tst);
$chhk = dbFetchRows('SELECT device_id FROM '.$tbl.' LIMIT 1');
if( isset($chhk[0]['device_id']) ) {
$chk[] = $tbl.'.';
}
$chk[] = $tst['TABLE_NAME'].'.';
}
}
}