title: using mysql in latex
body: <p>I have a mysql database that contains snippets of latex code, identified by a unique id which I imaginatively called id.</p>
  
  <p>Now I would like to typeset a document with latex in the following way:</p>
  
  <pre><code>\documentclass{article}
  \newcommand{\dbquery}[1]{???}
  \begin{document}
  Some text \dbquery{23} some more text etc.
  \end{document}
  </code></pre>
  
  <p>So the idea is, whenever the macro \dbquery appears, the latex code with id=23 in the db is inserted into the text.</p>
  
  <p>Any ideas?
  Thanks in advance.  </p>