[PHP] Solution for the Message in PHPMyAdmin: Query was empty!

During the few days, I’ve encountered a problem for operating PHPMyadmin at my workstation. It is very strange situation while  clicking the viewing button in PHPMyadmin. Whenever I click the viewing button, the result is always the shown message with “query was empty” in PHPMyAdmin.
[Note: Nov 5, 2012 – I’ve also found the bug existed in phpMyAdmin-3.5.4-rc1. No matter in 2.11.11 or 3.5.4, this bug is still not solved. Further, I have submitted this bug to the SourceForge for PHPMyAdmin

I’ve searched for the solutions in many pages, but there are no satisfied solutions.
But I am aware of the result URL is constructed in semicolon (; ), not &. There is a little bit of difference.
For example, the sample URL is like this (Notice that the red color character ):

http://localhost/phpmyadmin/index.php?db=mysql;token=2c0c27dfc21386677612120a81ae2e4a

In fact, it should be displayed as the following URL:
http://localhost/phpmyadmin/index.php?db=mysql&token=2c0c27dfc21386677612120a81ae2e4a

Thus, I review the php.ini file at my workstation. And one configuration is added.
arg_separator.input = “;”

It means that the argument separator is noted by “;”, not “&”. No wander that PHPMyAdmin can not run normally because of the wrong arg_separator.input.

In fact, there are two important functions in PHPMyAdmin, and both of them are written in libraries/url_generating.lib.php

In libraries/url_generating.lib.php, the url generating function is  PMA_generate_common_url :
At line 22, it calls $separator = PMA_get_arg_separator();. Let’s go to see PMA_get_arg_separator() in libraries/url_generating.lib.php .

It returns the corresponding arg_separator.input parameter. In this case, I’ve set arg_separator.input = “;”. Thus it returns “;”.

Let’s turn backup to PMA_generate_common_url.
In lines 24 to 29, it assigns $delim as the corresponding $seperator. However, we can see that $delim = “;” in this case. ( It is very strange why do this. I think it is wrong here. No matter that $delim is initially assigned in the function begining, it is always assigned as “arg_separator.input “.)

Therefore, PMA_generate_common_url returns db=mysql;token=2c0c27dfc21386677612120a81ae2e4a in line 63.

I suggest three solutions:
1. You can modify the configuration in php.ini. Just markup the arg_separator.input.
; arg_separator.input = “;”

2. If your program is installed in third-party server ( for instance, virtual machine or programming space) and the server allows use .htaccess file, you can edit .htaccess file by adding the following codes:
     php_value arg_separator.input &;

3. Modify  PMA_generate_common_url()  in libraries/url_generating.lib.php

About the Author

Leave a Reply

Your email address will not be published. Required fields are marked *

You may also like these