Follow this Blog!

Mar 7, 2013

f Comment

PhpMyAdmin: How Do You Change the Values of the Operator Drop Down List in the Search Page?

Amazon In PhpMyAdmin when I click on Search tab in some database table I'd like to change the order of the operators in the operator drop down list. This is because whenever I do a search I always want the default operator to be LIKE %...%, not LIKE. How do I do that in PhpMyAdmin's search interface?

My PhpMyAdmin's version is 3.4.10.1.
Solution
My PhpMyAdmin's root is C:/wamp2.2/apps/phpmyadmin3.4.10.1/. In that folder look for libraries/config.default.php. Edit this part of the code:
$cfg['TextOperators'] = array(
   'LIKE',
   'LIKE %...%',
   'NOT LIKE',
   '=',
   '!=',
   'REGEXP',
   'REGEXP ^...$',
   'NOT REGEXP',
   "= ''",
   "!= ''",
   'IN (...)',
   'NOT IN (...)',
   'BETWEEN',
   'NOT BETWEEN',
);
In my situation I'd like 'LIKE %...%' to be the first option; so I simply make 'LIKE %...%' the first value in the array so that this code becomes the following:
$cfg['TextOperators'] = array(
   'LIKE %...%',
   'LIKE',
   'NOT LIKE',
   '=',
   '!=',
   'REGEXP',
   'REGEXP ^...$',
   'NOT REGEXP',
   "= ''",
   "!= ''",
   'IN (...)',
   'NOT IN (...)',
   'BETWEEN',
   'NOT BETWEEN',
);
If you use a newer version of PhpMyAdmin such as 4.0.4 you will need to edit the following in C:/wamp2.4/apps/phpmyadmin4.0.4/libraries/Types.class.php.
public function getTextOperators()
    {
        return array(
     'LIKE %...%',
            'LIKE',
            'NOT LIKE',
            '=',
            '!=',
            'REGEXP',
            'REGEXP ^...$',
            'NOT REGEXP',
            "= ''",
            "!= ''",
            'IN (...)',
            'NOT IN (...)',
            'BETWEEN',
            'NOT BETWEEN',
        );
    }
Whatever version of PhpMyAdmin you are using, simply find the usage of LIKE %...% or NOT BETWEEN in C:/wamp2.2/apps/phpmyadmin3.4.10.1/libraries/ folder and make proper changes.

In your situation you may want to make other types of adjustment. You can even change the values according to your needs.

If you have any questions let me know and I will do my best to help you!
Please leave a comment here!
One Minute Information - by Michael Wen
Find Michael on Google or Facebook
ADVERTISING WITH US - Direct your advertising requests to Michael