title: Getting variable from Mysql with a Loop on MPDF
body: <p>I am trying to write something from the database in a MPDF file. I need to make a loop, but i can't do it inside the "WriteHTML" part, because it won't recognize as PHP code. 
  If i print the variable outside the loop, it won't recognize the whole array.</p>
  
  <pre><code>&lt;?php
  session_start();
  
  $id = $_SESSION['id'];
  $email = $_SESSION['email'];
  $pass = $_SESSION['pass'];
  $nivel = $_SESSION['nivel'];
  
  $funcao = $_SESSION['funcao'];
  $area = $_SESSION['area'];
  $nome = $_SESSION['nome'];
  $apelido = $_SESSION['apelido'];
  $chefe = $_SESSION['chefe'];
  include 'includes/connect.php';
  $id = $_SESSION['id'];
  
  
  include "mpdf/mpdf.php";
  </code></pre>
  
  <p>Here is the loop:</p>
  
  <pre><code>    $pc=mysql_query("SELECT * from pp where id_user=$id" );
      $row = array();
      while ($data = mysql_fetch_array($pc)) $row[] = $data; 
          foreach ($row as $x){
          $id_producto = $x[0];
          $nome = $x[1];
          $preco = $x[2];
          $descricao = $x[3];
  }
  </code></pre>
  
  <p>And the rest...</p>
  
  <pre><code>$html="
  &lt;center&gt;&lt;img src='imagens/logo.png' width='100' height='100'&gt;&lt;/center&gt;
  &lt;center&gt;&lt;h3&gt;Curriculo&lt;/h3&gt;&lt;/center&gt;
  Nome: $nome $apelido &lt;br&gt;
  E-Mail: $email &lt;bR&gt;
  Função: $funcao &lt;br&gt;
  Área: $area &lt;br&gt;
  Chefia: $chefe &lt;br&gt;
  
  
  &lt;h1&gt;titulo&lt;/h1&gt;
  ";
  
  
  $mpdf=new mPDF();
  $mpdf-&gt;WriteHTML($html);
  $mpdf-&gt;Output();
  exit;
  
  ?&gt;
  </code></pre>
  
  <p>Thanks</p>