From 1df57b7254f2d9e4c6aec76ff4df3512978175be Mon Sep 17 00:00:00 2001 From: Neil Lathwood Date: Fri, 19 Dec 2014 17:37:15 +0000 Subject: [PATCH] Added a fix for matching table names --- html/ajax_rulesuggest.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/html/ajax_rulesuggest.php b/html/ajax_rulesuggest.php index 7abd574e13..b4f410f4a8 100644 --- a/html/ajax_rulesuggest.php +++ b/html/ajax_rulesuggest.php @@ -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'].'.'; } } }