bookmarks.html 9.8 KB

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