bookmarks.html 9.5 KB

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