Favoritos

Nota

You need to have configured the Almacenamiento de configuración para phpMyAdmin for using bookmarks feature.

Storing bookmarks

Any query that is executed can be marked as a bookmark on the page where the results are displayed. You will find a button labeled Bookmark this query just at the end of the page. As soon as you have stored a bookmark, that query is linked to the database. You can now access a bookmark dropdown on each page where the query box appears on for that database.

Variables inside bookmarks

Inside a query, you can also add placeholders for variables. This is done by inserting into the query SQL comments between /* and */. The special string [VARIABLE{variable-number}] is used inside the comments. Be aware that the whole query minus the SQL comments must be valid by itself, otherwise you won’t be able to store it as a bookmark. Also, note that the text “VARIABLE” is case-sensitive.

Cuando ejecuta el favorito, todo lo que introduzca en la caja de entrada de variables en la página de la consulta reemplazará las cadenas /*[VARIABLE{variable-number}]*/ en su consulta almacenada.

También recuerde que todo lo que se encuentre dentro de la cadena /*[VARIABLE{variable-number}]*/ para su consulta se mantendrá como está pero se quitarán los caracteres /**/. Por lo que puede utilizar:

/*, [VARIABLE1] AS myname */

que será expandido a

, VARIABLE1 as myname

en su consulta, donde VARIABLE1 es la cadena introducida en la caja de texto Variable 1.

A more complex example, say you have stored this query:

SELECT Name, Address FROM addresses WHERE 1 /* AND Name LIKE '%[VARIABLE1]%' */

If you wish to enter «phpMyAdmin» as the variable for the stored query, the full query will be:

SELECT Name, Address FROM addresses WHERE 1 AND Name LIKE '%phpMyAdmin%'

NOTE LA FALTA DE ESPACIOS dentro de /**/. Cualquier espacio agregado allí será luego también agregado como espacio en la consulta y podría llevar a resultados inesperados, especialmente al utilizar la expansión de variables dentro de una expresión «LIKE “”».