bookmarks.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
  6. <title>Bookmarks &#8212; phpMyAdmin 5.2.2 documentation</title>
  7. <link rel="stylesheet" type="text/css" href="_static/pygments.css" />
  8. <link rel="stylesheet" type="text/css" href="_static/classic.css" />
  9. <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
  10. <script src="_static/jquery.js"></script>
  11. <script src="_static/underscore.js"></script>
  12. <script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
  13. <script src="_static/doctools.js"></script>
  14. <script src="_static/sphinx_highlight.js"></script>
  15. <link rel="index" title="Index" href="genindex.html" />
  16. <link rel="search" title="Search" href="search.html" />
  17. <link rel="copyright" title="Copyright" href="copyright.html" />
  18. <link rel="next" title="User management" href="privileges.html" />
  19. <link rel="prev" title="Transformations" href="transformations.html" />
  20. </head><body>
  21. <div class="related" role="navigation" aria-label="related navigation">
  22. <h3>Navigation</h3>
  23. <ul>
  24. <li class="right" style="margin-right: 10px">
  25. <a href="genindex.html" title="General Index"
  26. accesskey="I">index</a></li>
  27. <li class="right" >
  28. <a href="privileges.html" title="User management"
  29. accesskey="N">next</a> |</li>
  30. <li class="right" >
  31. <a href="transformations.html" title="Transformations"
  32. accesskey="P">previous</a> |</li>
  33. <li class="nav-item nav-item-0"><a href="index.html">phpMyAdmin 5.2.2 documentation</a> &#187;</li>
  34. <li class="nav-item nav-item-1"><a href="user.html" accesskey="U">User Guide</a> &#187;</li>
  35. <li class="nav-item nav-item-this"><a href="">Bookmarks</a></li>
  36. </ul>
  37. </div>
  38. <div class="document">
  39. <div class="documentwrapper">
  40. <div class="bodywrapper">
  41. <div class="body" role="main">
  42. <section id="bookmarks">
  43. <span id="id1"></span><h1>Bookmarks<a class="headerlink" href="#bookmarks" title="Permalink to this heading">¶</a></h1>
  44. <div class="admonition note">
  45. <p class="admonition-title">Note</p>
  46. <p>You need to have configured the <a class="reference internal" href="setup.html#linked-tables"><span class="std std-ref">phpMyAdmin configuration storage</span></a> for using bookmarks
  47. feature.</p>
  48. </div>
  49. <section id="storing-bookmarks">
  50. <h2>Storing bookmarks<a class="headerlink" href="#storing-bookmarks" title="Permalink to this heading">¶</a></h2>
  51. <p>Any query that is executed can be marked as a bookmark on the page
  52. where the results are displayed. You will find a button labeled
  53. <span class="guilabel">Bookmark this query</span> just at the end of the page. As soon as you have
  54. stored a bookmark, that query is linked to the database.
  55. You can now access a bookmark dropdown on each page where the query box appears on for that database.</p>
  56. </section>
  57. <section id="variables-inside-bookmarks">
  58. <h2>Variables inside bookmarks<a class="headerlink" href="#variables-inside-bookmarks" title="Permalink to this heading">¶</a></h2>
  59. <p>Inside a query, you can also add placeholders for variables.
  60. This is done by inserting into the query SQL comments between <code class="docutils literal notranslate"><span class="pre">/*</span></code> and
  61. <code class="docutils literal notranslate"><span class="pre">*/</span></code>. The special string <code class="docutils literal notranslate"><span class="pre">[VARIABLE{variable-number}]</span></code> is used inside the comments.
  62. Be aware that the whole query minus the SQL comments must be
  63. valid by itself, otherwise you won’t be able to store it as a bookmark.
  64. Also, note that the text ‘VARIABLE’ is case-sensitive.</p>
  65. <p>When you execute the bookmark, everything typed into the <em>Variables</em>
  66. input boxes on the query box page will replace the strings <code class="docutils literal notranslate"><span class="pre">/*[VARIABLE{variable-number}]*/</span></code> in
  67. your stored query.</p>
  68. <p>Also remember, that everything else inside the <code class="docutils literal notranslate"><span class="pre">/*[VARIABLE{variable-number}]*/</span></code> string for
  69. your query will remain the way it is, but will be stripped of the <code class="docutils literal notranslate"><span class="pre">/**/</span></code>
  70. chars. So you can use:</p>
  71. <div class="highlight-mysql notranslate"><div class="highlight"><pre><span></span><span class="cm">/*, [VARIABLE1] AS myname */</span>
  72. </pre></div>
  73. </div>
  74. <p>which will be expanded to</p>
  75. <div class="highlight-mysql notranslate"><div class="highlight"><pre><span></span><span class="p">,</span><span class="w"> </span><span class="n">VARIABLE1</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">myname</span>
  76. </pre></div>
  77. </div>
  78. <p>in your query, where VARIABLE1 is the string you entered in the Variable 1 input box.</p>
  79. <p>A more complex example, say you have stored this query:</p>
  80. <div class="highlight-mysql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="k">Name</span><span class="p">,</span><span class="w"> </span><span class="n">Address</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">addresses</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="cm">/* AND Name LIKE &#39;%[VARIABLE1]%&#39; */</span>
  81. </pre></div>
  82. </div>
  83. <p>If you wish to enter “phpMyAdmin” as the variable for the stored query, the full
  84. query will be:</p>
  85. <div class="highlight-mysql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span><span class="w"> </span><span class="k">Name</span><span class="p">,</span><span class="w"> </span><span class="n">Address</span><span class="w"> </span><span class="k">FROM</span><span class="w"> </span><span class="n">addresses</span><span class="w"> </span><span class="k">WHERE</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="k">AND</span><span class="w"> </span><span class="k">Name</span><span class="w"> </span><span class="k">LIKE</span><span class="w"> </span><span class="s1">&#39;%phpMyAdmin%&#39;</span>
  86. </pre></div>
  87. </div>
  88. <p><strong>NOTE THE ABSENCE OF SPACES</strong> inside the <code class="docutils literal notranslate"><span class="pre">/**/</span></code> construct. Any spaces
  89. inserted there will be later also inserted as spaces in your query and may lead
  90. to unexpected results especially when using the variable expansion inside of a
  91. “LIKE ‘’” expression.</p>
  92. </section>
  93. <section id="browsing-a-table-using-a-bookmark">
  94. <h2>Browsing a table using a bookmark<a class="headerlink" href="#browsing-a-table-using-a-bookmark" title="Permalink to this heading">¶</a></h2>
  95. <p>When a bookmark has the same name as the table, it will be used as the query when browsing
  96. this table.</p>
  97. <div class="admonition seealso">
  98. <p class="admonition-title">See also</p>
  99. <p><a class="reference internal" href="faq.html#faqbookmark"><span class="std std-ref">6.18 Bookmarks: Where can I store bookmarks? Why can’t I see any bookmarks below the query box? What are these variables for?</span></a>,
  100. <a class="reference internal" href="faq.html#faq6-22"><span class="std std-ref">6.22 Bookmarks: Can I execute a default bookmark automatically when entering Browse mode for a table?</span></a></p>
  101. </div>
  102. </section>
  103. </section>
  104. <div class="clearer"></div>
  105. </div>
  106. </div>
  107. </div>
  108. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  109. <div class="sphinxsidebarwrapper">
  110. <div>
  111. <h3><a href="index.html">Table of Contents</a></h3>
  112. <ul>
  113. <li><a class="reference internal" href="#">Bookmarks</a><ul>
  114. <li><a class="reference internal" href="#storing-bookmarks">Storing bookmarks</a></li>
  115. <li><a class="reference internal" href="#variables-inside-bookmarks">Variables inside bookmarks</a></li>
  116. <li><a class="reference internal" href="#browsing-a-table-using-a-bookmark">Browsing a table using a bookmark</a></li>
  117. </ul>
  118. </li>
  119. </ul>
  120. </div>
  121. <div>
  122. <h4>Previous topic</h4>
  123. <p class="topless"><a href="transformations.html"
  124. title="previous chapter">Transformations</a></p>
  125. </div>
  126. <div>
  127. <h4>Next topic</h4>
  128. <p class="topless"><a href="privileges.html"
  129. title="next chapter">User management</a></p>
  130. </div>
  131. <div role="note" aria-label="source link">
  132. <h3>This Page</h3>
  133. <ul class="this-page-menu">
  134. <li><a href="_sources/bookmarks.rst.txt"
  135. rel="nofollow">Show Source</a></li>
  136. </ul>
  137. </div>
  138. <div id="searchbox" style="display: none" role="search">
  139. <h3 id="searchlabel">Quick search</h3>
  140. <div class="searchformwrapper">
  141. <form class="search" action="search.html" method="get">
  142. <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
  143. <input type="submit" value="Go" />
  144. </form>
  145. </div>
  146. </div>
  147. <script>document.getElementById('searchbox').style.display = "block"</script>
  148. </div>
  149. </div>
  150. <div class="clearer"></div>
  151. </div>
  152. <div class="related" role="navigation" aria-label="related navigation">
  153. <h3>Navigation</h3>
  154. <ul>
  155. <li class="right" style="margin-right: 10px">
  156. <a href="genindex.html" title="General Index"
  157. >index</a></li>
  158. <li class="right" >
  159. <a href="privileges.html" title="User management"
  160. >next</a> |</li>
  161. <li class="right" >
  162. <a href="transformations.html" title="Transformations"
  163. >previous</a> |</li>
  164. <li class="nav-item nav-item-0"><a href="index.html">phpMyAdmin 5.2.2 documentation</a> &#187;</li>
  165. <li class="nav-item nav-item-1"><a href="user.html" >User Guide</a> &#187;</li>
  166. <li class="nav-item nav-item-this"><a href="">Bookmarks</a></li>
  167. </ul>
  168. </div>
  169. <div class="footer" role="contentinfo">
  170. &#169; <a href="copyright.html">Copyright</a> 2012 - 2024, The phpMyAdmin devel team.
  171. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.3.0.
  172. </div>
  173. </body>
  174. </html>