Home / phpMyAdmin prevent popup window for query editing

phpMyAdmin prevent popup window for query editing

phpMyAdmin by default opens a popup window when you click the "Edit" link underneath a query. I personally prefer to not have a popup window open and this post looks at how to change the default behaviour.

What is phpMyAdmin?

phpMyAdmin is a PHP tool for administrating MySQL databases in a web browser. You can find out more information at the phpMyAdmin website.

Editing queries in a popup window

After running a query in phpMyAdmin, the sql query is displayed and directly underneath are links to edit the query and other options. This is shown in the screenshot below. The "Edit" link with the red circle around it is what you would click to edit the query displayed.

phpmyadmin query

The default behaviour of phpMyAdmin is to open up a popup window with Javascript and allow you to edit the query in that window. The result of this operation is displayed in the screenshot below. After editing your query and clicking the "Go" button, the query is passed back to the opening window and run there (but see my notes below about browser compatibility). The popup window remains and you can continue refining the query etc

phpmyadmin popup window

This works nicely in Firefox and Internet Explorer, but in Konqueror it opens it in another tab in the same popup window which makes it a bit useless, and in Opera it opens a new tab instead of sending the query back to the original tab which also a bit annoying.

Stop phpMyAdmin editing queries in a popup window

To prevent phpMyAdmin opening a popup window to edit queries after clicking the "Edit" link, you need to open up and edit the config.inc.php file. This is the root folder for phpMyAdmin. The current releases do not have one of these files by default and you would normally copy config.sample.inc.php as config.inc.php and edit that. (You would have needed to create a config.inc.php file when you installed phpMyAdmin to get it to work anyway).

All you need to do is add the following line anywhere in the file within the opening and closing PHP tags:

$cfg['EditInWindow'] = false;

After making this change, when you click the "Edit" link it will open it in the same window instead of opening up a popup window.