title: Using query values outside a function
body: <p>i need to use a "question" variable outside the function:</p>
  
  <pre><code>public  function name(){
      if($_SESSION[agT] == "random" AND $_SESSION[ct]=="random"){
      $consult = DB::getConn()-&gt;prepare('SELECT * FROM table ORDER BY RAND() LIMIT 1');
      $consult-&gt;execute();
      $question=$consult-&gt;fetch(PDO::FETCH_ASSOC);
  }
  </code></pre>
  
  <p>Like </p>
  
  <pre><code>echo "$question[column];
  echo "$question[anothercolumn]; 
  </code></pre>