Fix for failure to search if columns have spaces/symbols

Discuss MySQL Ajax Table Editor

Fix for failure to search if columns have spaces/symbols

Postby Bob Kiwi » Mon Nov 27, 2017 4:46 pm

I recently updated from 3.2 to 4.2 to get legacy MATE pages working on PHP 7.

My tables with spaces in them stopped working for searching. I found this was because the parameters were being made with spaces or symbols and then failing.

I fixed this by editing AjaxTableEditor.php's function getQuickSearchSets by adding the following code for some example symbols/spaces:

Code: Select all
                                        $col_query = str_replace(' ', '_', $col);
                                        $col_query = str_replace('/', '_', $col_query);
                                        $col_query = str_replace('-', '_', $col_query);
                                        $col_query = str_replace('#', '_', $col_query);
               $queryParamStr = $col_query.'_qsearch';
//               $queryParamStr = $col.'_qsearch';


and for Advanced Search by editing getAdvancedSearchSets:

Code: Select all
                                        $col_query = str_replace(' ', '_', $asInfo['cols']);
                                        $col_query = str_replace('/', '_', $col_query);
                                        $col_query = str_replace('-', '_', $col_query);
                                        $col_query = str_replace('#', '_', $col_query);
                                       
               $queryParamStr = $col_query.'_'.$i.'_asearch';
//               $queryParamStr = $asInfo['cols'].'_'.$i.'_asearch';


This allowed my pages to work as expected. I had initially wrote this up as a question, but solved it on my own and figured others may benefit.
Bob Kiwi
 
Posts: 3
Joined: Wed Dec 21, 2011 3:56 pm

Return to Open Discussion

Who is online

Users browsing this forum: Google [Bot] and 12 guests

cron