bookmarks — phpmyadmin 5.2.0 documentation-尊龙登录

note

you need to have configured the phpmyadmin configuration storage 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.

when you execute the bookmark, everything typed into the variables input boxes on the query box page will replace the strings /*[variable{variable-number}]*/ in your stored query.

also remember, that everything else inside the /*[variable{variable-number}]*/ string for your query will remain the way it is, but will be stripped of the /**/ chars. so you can use:

/*, [variable1] as myname */

which will be expanded to

, variable1 as myname

in your query, where variable1 is the string you entered in the variable 1 input box.

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 the absence of spaces inside the /**/ construct. any spaces inserted there will be later also inserted as spaces in your query and may lead to unexpected results especially when using the variable expansion inside of a “like ‘’” expression.